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

14 lines
335 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);
}