first test of sendable fns (passes)

This commit is contained in:
Niko Matsakis 2011-12-15 16:10:01 -08:00
parent 21cc0c6e69
commit 4465c1ad02

View File

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