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

14 lines
333 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
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);
}