diff options
Diffstat (limited to 'tests/ui/generics/generic-unique.rs')
-rw-r--r-- | tests/ui/generics/generic-unique.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/generics/generic-unique.rs b/tests/ui/generics/generic-unique.rs new file mode 100644 index 000000000..2f34712ec --- /dev/null +++ b/tests/ui/generics/generic-unique.rs @@ -0,0 +1,11 @@ +// run-pass +#![allow(dead_code)] + +struct Triple<T> { x: T, y: T, z: T } + +fn box_it<T>(x: Triple<T>) -> Box<Triple<T>> { return Box::new(x); } + +pub fn main() { + let x: Box<Triple<isize>> = box_it::<isize>(Triple{x: 1, y: 2, z: 3}); + assert_eq!(x.y, 2); +} |