summary refs log tree commit diff
path: root/src/test/run-pass/box-unbox.rs
blob: be9981ccdbe30f73deb86eb875bf8eca89f13cf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12


type box<T: copy> = {c: @T};

fn unbox<T: copy>(b: box<T>) -> T { ret *b.c; }

fn main() {
    let foo: int = 17;
    let bfoo: box<int> = {c: @foo};
    #debug("see what's in our box");
    assert (unbox::<int>(bfoo) == foo);
}