rust/src/test/run-pass/issue-507.rs
Marijn Haverbeke 1a68a98824 Disallow writing to function arguments again
Remove implicit copying hack.

Closes #1118
2011-11-03 10:57:54 +01:00

38 lines
598 B
Rust

/*
This is a test case for Issue 507.
https://github.com/graydon/rust/issues/507
*/
use std;
import std::task;
import std::task::join;
import std::comm;
import std::comm::chan;
import std::comm::send;
import std::comm::port;
import std::comm::recv;
fn grandchild(c: chan<int>) { send(c, 42); }
fn child(c: chan<int>) {
let _grandchild = task::spawn_joinable(copy c, grandchild);
join(_grandchild);
}
fn main() {
let p = comm::port();
let _child = task::spawn_joinable(chan(p), child);
let x: int = recv(p);
log x;
assert (x == 42);
join(_child);
}