Skip to content

Commit 109a9d2

Browse files
committed
---
yaml --- r: 13193 b: refs/heads/master c: de40318 h: refs/heads/master i: 13191: 358da6b v: v3
1 parent 36c95c7 commit 109a9d2

File tree

4 files changed

+45
-1
lines changed

4 files changed

+45
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 11b4a92fc89705b706cf2d3456cc04a8a7d732cd
2+
refs/heads/master: de403180376c80f9ef8cb8e90d12b3c936e160d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// error-pattern: copying a noncopyable value
2+
3+
// Test that a class with a non-copyable field can't be
4+
// copied
5+
class bar {
6+
new() {}
7+
drop {}
8+
}
9+
10+
class foo {
11+
let i: int;
12+
let j: bar;
13+
new(i:int) { self.i = i; self.j = bar(); }
14+
}
15+
16+
fn main() { let x <- foo(10); let y = x; log(error, x); }
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Test that a class with an unsendable field can't be
2+
// sent
3+
4+
class foo {
5+
let i: int;
6+
let j: @str;
7+
new(i:int, j: @str) { self.i = i; self.j = j; }
8+
}
9+
10+
fn main() {
11+
let cat = "kitty";
12+
let po = comm::port(); //! ERROR missing `send`
13+
let ch = comm::chan(po); //! ERROR missing `send`
14+
comm::send(ch, foo(42, @cat)); //! ERROR missing `send`
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Test that a class with only sendable fields can be sent
2+
3+
class foo {
4+
let i: int;
5+
let j: char;
6+
new(i:int, j: char) { self.i = i; self.j = j; }
7+
}
8+
9+
fn main() {
10+
let po = comm::port::<foo>();
11+
let ch = comm::chan(po);
12+
comm::send(ch, foo(42, 'c'));
13+
}

0 commit comments

Comments
 (0)