Skip to content

Commit 44ea9bf

Browse files
committed
---
yaml --- r: 5571 b: refs/heads/master c: e42f3b8 h: refs/heads/master i: 5569: 2c76491 5567: 5030aad v: v3
1 parent 1476fc8 commit 44ea9bf

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 923aa4744eed0a2e82c89605221ac3aad616ee05
2+
refs/heads/master: e42f3b8481049fd3626c24b95297282b68df1436

trunk/src/comp/middle/trans.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,13 +2020,15 @@ fn type_is_structural_or_param(tcx: ty::ctxt, t: ty::t) -> bool {
20202020

20212021
fn copy_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
20222022
src: ValueRef, t: ty::t) -> @block_ctxt {
2023-
if type_is_structural_or_param(bcx_ccx(cx).tcx, t) &&
2024-
action == DROP_EXISTING {
2023+
if action == DROP_EXISTING &&
2024+
(type_is_structural_or_param(bcx_tcx(cx), t) ||
2025+
ty::type_is_unique(bcx_tcx(cx), t)) {
20252026
let do_copy_cx = new_sub_block_ctxt(cx, "do_copy");
20262027
let next_cx = new_sub_block_ctxt(cx, "next");
2028+
let dstcmp = load_if_immediate(cx, dst, t);
20272029
let self_assigning =
2028-
ICmp(cx, lib::llvm::LLVMIntNE, PointerCast(cx, dst, val_ty(src)),
2029-
src);
2030+
ICmp(cx, lib::llvm::LLVMIntNE,
2031+
PointerCast(cx, dstcmp, val_ty(src)), src);
20302032
CondBr(cx, self_assigning, do_copy_cx.llbb, next_cx.llbb);
20312033
do_copy_cx = copy_val_no_check(do_copy_cx, action, dst, src, t);
20322034
Br(do_copy_cx, next_cx.llbb);

0 commit comments

Comments
 (0)