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

13 lines
234 B
Rust
Raw Normal View History

type box<T: copy> = {c: @T};
2010-06-23 21:03:09 -07:00
2012-08-01 17:30:05 -07:00
fn unbox<T: copy>(b: box<T>) -> T { return *b.c; }
2010-06-23 21:03:09 -07:00
fn main() {
2011-07-27 14:19:39 +02:00
let foo: int = 17;
let bfoo: box<int> = {c: @foo};
debug!{"see what's in our box"};
assert (unbox::<int>(bfoo) == foo);
}