rust/src/test/run-pass/regions-static-closure.rs

17 lines
285 B
Rust
Raw Normal View History

struct closure_box {
cl: &fn(),
}
2012-09-19 05:45:24 +00:00
fn box_it(+x: &r/fn()) -> closure_box/&r {
closure_box {cl: move x}
}
fn call_static_closure(cl: closure_box/&static) {
cl.cl();
}
fn main() {
let cl_box = box_it(|| debug!("Hello, world!"));
2012-09-19 05:45:24 +00:00
call_static_closure(move cl_box);
}