rust/src/test/compile-fail/unsendable-class.rs

22 lines
399 B
Rust
Raw Normal View History

// Test that a class with an unsendable field can't be
// sent
2012-08-15 18:46:55 -07:00
struct foo {
2012-09-06 19:40:15 -07:00
i: int,
j: @~str,
2012-09-05 15:58:43 -07:00
}
fn foo(i:int, j: @~str) -> foo {
foo {
i: i,
j: j
}
}
fn main() {
let cat = ~"kitty";
2012-08-27 14:22:25 -07:00
let po = comm::Port(); //~ ERROR missing `send`
2012-10-03 14:38:01 -07:00
let ch = comm::Chan(&po); //~ ERROR missing `send`
2012-09-18 22:44:46 -07:00
comm::send(ch, foo(42, @(move cat))); //~ ERROR missing `send`
}