diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 555236e6415a..15ad627c207b 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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); } diff --git a/src/test/run-pass/unique-assign-drop.rs b/src/test/run-pass/unique-assign-drop.rs new file mode 100644 index 000000000000..4a3a12cb9cc9 --- /dev/null +++ b/src/test/run-pass/unique-assign-drop.rs @@ -0,0 +1,7 @@ +fn main() { + let i = ~1; + let j = ~2; + // Should drop the previous value of j + j = i; + assert *j == 1; +} \ No newline at end of file