From 67c9ef9b306e6f45842a474e66d122c96139e02c Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 1 Jul 2011 20:07:19 -0700 Subject: [PATCH] rustc: Fix memory corruption with ivectors-inside-ivectors by duplicating *first*, and *then* copying subtypes. --- src/comp/middle/trans.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 7355b49806d..4e930429afe 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1945,8 +1945,8 @@ fn make_copy_glue(&@block_ctxt cx, ValueRef v, &ty::t t) { if (ty::type_is_boxed(cx.fcx.lcx.ccx.tcx, t)) { bcx = incr_refcnt_of_boxed(cx, cx.build.Load(v)).bcx; } else if (ty::type_is_structural(cx.fcx.lcx.ccx.tcx, t)) { - bcx = iter_structural_ty(cx, v, t, bind copy_ty(_, _, _)).bcx; - bcx = duplicate_heap_parts_if_necessary(bcx, v, t).bcx; + bcx = duplicate_heap_parts_if_necessary(cx, v, t).bcx; + bcx = iter_structural_ty(bcx, v, t, bind copy_ty(_, _, _)).bcx; } else { bcx = cx; } bcx.build.RetVoid(); }