summaryrefslogtreecommitdiffstats
path: root/tests/ui/generics/issue-2936.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/generics/issue-2936.rs')
-rw-r--r--tests/ui/generics/issue-2936.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/generics/issue-2936.rs b/tests/ui/generics/issue-2936.rs
new file mode 100644
index 000000000..6b932d01d
--- /dev/null
+++ b/tests/ui/generics/issue-2936.rs
@@ -0,0 +1,31 @@
+// run-pass
+#![allow(non_camel_case_types)]
+
+trait bar<T> {
+ fn get_bar(&self) -> T;
+}
+
+fn foo<T, U: bar<T>>(b: U) -> T {
+ b.get_bar()
+}
+
+struct cbar {
+ x: isize,
+}
+
+impl bar<isize> for cbar {
+ fn get_bar(&self) -> isize {
+ self.x
+ }
+}
+
+fn cbar(x: isize) -> cbar {
+ cbar {
+ x: x
+ }
+}
+
+pub fn main() {
+ let x: isize = foo::<isize, cbar>(cbar(5));
+ assert_eq!(x, 5);
+}