Skip to content

Commit e30a8b6

Browse files
committed
Updating kind rules to make sure we don't sneakily send ports.
1 parent 3cf582b commit e30a8b6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/rustc/middle/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
16081608
}
16091609
ty_res(did, inner, tps) {
16101610
let inner = subst(cx, tps, inner);
1611-
(kind_const() & type_kind(cx, inner)) | kind_send_only()
1611+
(kind_const() | kind_send_only()) & type_kind(cx, inner)
16121612
}
16131613
ty_param(_, did) {
16141614
param_bounds_to_kind(cx.ty_param_bounds.get(did.node))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
resource foo(_x: comm::port<()>) {}
3+
4+
let x = ~mut some(foo(comm::port()));
5+
6+
task::spawn {|move x| //! ERROR not a sendable value
7+
let mut y = none;
8+
*x <-> y;
9+
log(error, y);
10+
}
11+
}

0 commit comments

Comments
 (0)