diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/generics/issue-2936.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/generics/issue-2936.rs b/src/test/ui/generics/issue-2936.rs new file mode 100644 index 000000000..6b932d01d --- /dev/null +++ b/src/test/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); +} |