Skip to content

Commit 67c9ef9

Browse files
committed
rustc: Fix memory corruption with ivectors-inside-ivectors by duplicating *first*, and *then* copying subtypes.
1 parent d39c59a commit 67c9ef9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/comp/middle/trans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,8 +1945,8 @@ fn make_copy_glue(&@block_ctxt cx, ValueRef v, &ty::t t) {
19451945
if (ty::type_is_boxed(cx.fcx.lcx.ccx.tcx, t)) {
19461946
bcx = incr_refcnt_of_boxed(cx, cx.build.Load(v)).bcx;
19471947
} else if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, t)) {
1948-
bcx = iter_structural_ty(cx, v, t, bind copy_ty(_, _, _)).bcx;
1949-
bcx = duplicate_heap_parts_if_necessary(bcx, v, t).bcx;
1948+
bcx = duplicate_heap_parts_if_necessary(cx, v, t).bcx;
1949+
bcx = iter_structural_ty(bcx, v, t, bind copy_ty(_, _, _)).bcx;
19501950
} else { bcx = cx; }
19511951
bcx.build.RetVoid();
19521952
}

0 commit comments

Comments
 (0)