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

9 lines
188 B
Rust
Raw Normal View History

2012-08-01 19:30:05 -05:00
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);
}