Don't allow vectors of pinned kinds to be copied
This commit is contained in:
parent
4bee452221
commit
99cbea51a1
@ -150,6 +150,10 @@ fn check_copy(tcx: ty::ctxt, e: @ast::expr) {
|
||||
demand_kind(tcx, e.span, mt.ty, ast::kind_shared,
|
||||
"unique box interior");
|
||||
}
|
||||
ty::ty_vec(mt) {
|
||||
demand_kind(tcx, e.span, mt.ty, ast::kind_shared,
|
||||
"vector interior");
|
||||
}
|
||||
_ { }
|
||||
}
|
||||
}
|
||||
|
10
src/test/compile-fail/vec-pinned-nocopy.rs
Normal file
10
src/test/compile-fail/vec-pinned-nocopy.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// error-pattern: mismatched kind
|
||||
|
||||
resource r(b: bool) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let i = [r(true)];
|
||||
let j;
|
||||
j = i;
|
||||
}
|
Loading…
Reference in New Issue
Block a user