Fix copying of fixed length vectors. Closes #2630.

This commit is contained in:
Michael Sullivan 2012-06-15 15:30:57 -07:00
parent a56902304d
commit 6e63e2fd5f
2 changed files with 11 additions and 2 deletions

View file

@ -1404,8 +1404,7 @@ fn copy_val_no_check(bcx: block, action: copy_action, dst: ValueRef,
ret bcx;
}
if ty::type_is_nil(t) || ty::type_is_bot(t) { ret bcx; }
if ty::type_is_boxed(t) || ty::type_is_vec(t) ||
ty::type_is_unique_box(t) {
if ty::type_is_boxed(t) || ty::type_is_unique(t) {
if action == DROP_EXISTING { bcx = drop_ty(bcx, dst, t); }
Store(bcx, src, dst);
ret take_ty(bcx, dst, t);

View file

@ -0,0 +1,10 @@
// error on implicit copies to check fixed length vectors
// are implicitly copyable
#[warn(err_implicit_copies)]
fn main() {
let arr = [1,2,3]/3;
let arr2 = arr;
assert(arr[1] == 2);
assert(arr2[2] == 3);
}