]> git.lizzy.rs Git - rust.git/blob - tests/ui/generics/generic-unique.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / generics / generic-unique.rs
1 // run-pass
2 #![allow(dead_code)]
3
4 struct Triple<T> { x: T, y: T, z: T }
5
6 fn box_it<T>(x: Triple<T>) -> Box<Triple<T>> { return Box::new(x); }
7
8 pub fn main() {
9     let x: Box<Triple<isize>> = box_it::<isize>(Triple{x: 1, y: 2, z: 3});
10     assert_eq!(x.y, 2);
11 }