rust/src/test/run-pass/monomorphize-trait-in-fn-at.rs
2012-08-08 18:19:24 -07:00

22 lines
357 B
Rust

// test that invoking functions which require
// dictionaries from inside an fn@ works
// (at one point, it didn't)
fn mk_nil<C:ty_ops>(cx: C) -> uint {
cx.mk()
}
trait ty_ops {
fn mk() -> uint;
}
impl (): ty_ops {
fn mk() -> uint { 22u }
}
fn main() {
let fn_env = fn@() -> uint {
mk_nil(())
};
assert fn_env() == 22u;
}