rust/src/test/run-pass/sendfn-spawn-with-fn-arg.rs
Tim Chevalier 39d9c30a15 Remove code from parser that was awaiting snapshot
Remove old parser functions as well as support for old-style capture
clauses. Remove remaining old-style capture clauses.
2012-06-14 19:09:02 -07:00

22 lines
373 B
Rust

use std;
import comm::chan;
import comm::send;
fn main() { test05(); }
fn test05_start(&&f: fn~(int)) {
f(22);
}
fn test05() {
let three = ~3;
let fn_to_send = fn~(n: int) {
log(error, *three + n); // will copy x into the closure
assert(*three == 3);
};
task::spawn(fn~(move fn_to_send) {
test05_start(fn_to_send);
});
}