rust/src/test/run-pass/generic-exterior-box.rs
2010-06-23 21:03:09 -07:00

14 lines
333 B
Rust

type tupbox[T] = tup(@T);
type recbox[T] = rec(@T x);
fn tuplift[T](T t) -> tupbox[T] { ret tup(@t); }
fn reclift[T](T t) -> recbox[T] { ret rec(x=@t); }
fn main() {
let int foo = 17;
let tupbox[int] tbfoo = tuplift[int](foo);
let recbox[int] rbfoo = reclift[int](foo);
check (tbfoo._0 == foo);
check (rbfoo.x == foo);
}