Skip to content

Commit 60657fa

Browse files
committed
Set the cleanup on the post-growth vector, not the temporary one.
1 parent 2cbfb87 commit 60657fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,10 +2470,11 @@ fn trans_vec_add(@block_ctxt cx, @ty.t t,
24702470
ValueRef lhs, ValueRef rhs) -> result {
24712471
auto r = alloc_ty(cx, t);
24722472
auto tmp = r.val;
2473-
find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tmp, t));
24742473
r = copy_ty(r.bcx, INIT, tmp, lhs, t);
24752474
auto bcx = trans_vec_append(r.bcx, t, tmp, rhs).bcx;
2476-
ret res(bcx, load_scalar_or_boxed(bcx, tmp, t));
2475+
tmp = load_scalar_or_boxed(bcx, tmp, t);
2476+
find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tmp, t));
2477+
ret res(bcx, tmp);
24772478
}
24782479

24792480

0 commit comments

Comments
 (0)