rust/src/test/run-pass/generic-unique.rs

8 lines
187 B
Rust
Raw Normal View History

fn box<T: Copy>(x: {x: T, y: T, z: T}) -> ~{x: T, y: T, z: T} { return ~x; }
fn main() {
let x: ~{x: int, y: int, z: int} = box::<int>({x: 1, y: 2, z: 3});
assert (x.y == 2);
}