mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
Updating kind rules to make sure we don't sneakily send ports.
This commit is contained in:
parent
3cf582b529
commit
e30a8b6f8c
@ -1608,7 +1608,7 @@ fn type_kind(cx: ctxt, ty: t) -> kind {
|
||||
}
|
||||
ty_res(did, inner, tps) {
|
||||
let inner = subst(cx, tps, inner);
|
||||
(kind_const() & type_kind(cx, inner)) | kind_send_only()
|
||||
(kind_const() | kind_send_only()) & type_kind(cx, inner)
|
||||
}
|
||||
ty_param(_, did) {
|
||||
param_bounds_to_kind(cx.ty_param_bounds.get(did.node))
|
||||
|
11
src/test/compile-fail/no-send-res-ports.rs
Normal file
11
src/test/compile-fail/no-send-res-ports.rs
Normal file
@ -0,0 +1,11 @@
|
||||
fn main() {
|
||||
resource foo(_x: comm::port<()>) {}
|
||||
|
||||
let x = ~mut some(foo(comm::port()));
|
||||
|
||||
task::spawn {|move x| //! ERROR not a sendable value
|
||||
let mut y = none;
|
||||
*x <-> y;
|
||||
log(error, y);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user