Drop the previous value when copying one unique box local to another

Issue #409
This commit is contained in:
Brian Anderson 2011-09-22 13:51:40 -07:00
parent 7c4fe10f02
commit 3f41563cc9
2 changed files with 8 additions and 2 deletions

View file

@ -2031,8 +2031,7 @@ fn copy_val_no_check(cx: @block_ctxt, action: copy_action, dst: ValueRef,
}
if ty::type_is_unique_box(ccx.tcx, t) {
let bcx = cx;
// FIXME (409): Write a test and uncomment
//if action == DROP_EXISTING { bcx = drop_ty(cx, dst, t); }
if action == DROP_EXISTING { bcx = drop_ty(cx, dst, t); }
check trans_uniq::type_is_unique_box(bcx, t);
ret trans_uniq::copy_val(bcx, dst, src, t);
}