Fix copying of fixed length vectors. Closes #2630.
This commit is contained in:
parent
a56902304d
commit
6e63e2fd5f
2 changed files with 11 additions and 2 deletions
|
@ -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);
|
||||
|
|
10
src/test/run-pass/fixed_length_copy.rs
Normal file
10
src/test/run-pass/fixed_length_copy.rs
Normal 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);
|
||||
}
|
Loading…
Reference in a new issue