Set the cleanup on the post-growth vector, not the temporary one.
This commit is contained in:
parent
2cbfb8795d
commit
60657fa8aa
1 changed files with 3 additions and 2 deletions
|
@ -2470,10 +2470,11 @@ fn trans_vec_add(@block_ctxt cx, @ty.t t,
|
||||||
ValueRef lhs, ValueRef rhs) -> result {
|
ValueRef lhs, ValueRef rhs) -> result {
|
||||||
auto r = alloc_ty(cx, t);
|
auto r = alloc_ty(cx, t);
|
||||||
auto tmp = r.val;
|
auto tmp = r.val;
|
||||||
find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tmp, t));
|
|
||||||
r = copy_ty(r.bcx, INIT, tmp, lhs, t);
|
r = copy_ty(r.bcx, INIT, tmp, lhs, t);
|
||||||
auto bcx = trans_vec_append(r.bcx, t, tmp, rhs).bcx;
|
auto bcx = trans_vec_append(r.bcx, t, tmp, rhs).bcx;
|
||||||
ret res(bcx, load_scalar_or_boxed(bcx, tmp, t));
|
tmp = load_scalar_or_boxed(bcx, tmp, t);
|
||||||
|
find_scope_cx(cx).cleanups += clean(bind drop_ty(_, tmp, t));
|
||||||
|
ret res(bcx, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue