rust/src/test/run-pass/box-unbox.rs
2011-07-27 15:54:33 +02:00

12 lines
213 B
Rust

type box[T] = {c: @T};
fn unbox[T](b: &box[T]) -> T { ret *b.c; }
fn main() {
let foo: int = 17;
let bfoo: box[int] = {c: @foo};
log "see what's in our box";
assert (unbox[int](bfoo) == foo);
}