summary refs log tree commit diff
path: root/src/test/compile-fail/unsendable-class.rs
blob: a47a8b76e56a98f170b2f973569772fdce49b56a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Test that a class with an unsendable field can't be
// sent

struct foo {
  i: int,
  j: @~str,
}

fn foo(i:int, j: @~str) -> foo {
    foo {
        i: i,
        j: j
    }
}

fn main() {
  let cat = ~"kitty";
  let po = comm::Port();         //~ ERROR missing `send`
  let ch = comm::Chan(&po);       //~ ERROR missing `send`
  comm::send(ch, foo(42, @cat)); //~ ERROR missing `send`
}