Skip to content

Commit 5483b91

Browse files
committed
Convert a block to a fn in trans_ivec::trans_add
The block was not valgrind-clean
1 parent 9f41bc8 commit 5483b91

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/comp/middle/trans_ivec.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ fn trans_add(bcx: &@block_ctxt, vec_ty: ty::t, lhs: ValueRef,
202202
alloc(bcx, vec_ty, new_fill, true);
203203

204204
let write_ptr_ptr = do_spill(bcx, get_dataptr(bcx, new_vec, llunitty));
205-
let copy_block = { | &bcx, addr, _ty |
205+
let copy_fn = bind fn(bcx: &@block_ctxt, addr: ValueRef, _ty: ty::t,
206+
write_ptr_ptr: ValueRef, unit_ty: ty::t,
207+
llunitsz: ValueRef) -> result {
206208
let write_ptr = Load(bcx, write_ptr_ptr);
207209
let bcx = copy_val(bcx, INIT, write_ptr,
208210
load_if_immediate(bcx, addr, unit_ty), unit_ty);
@@ -213,10 +215,10 @@ fn trans_add(bcx: &@block_ctxt, vec_ty: ty::t, lhs: ValueRef,
213215
incr_ptr(bcx, write_ptr, C_int(1), write_ptr_ptr);
214216
}
215217
ret rslt(bcx, C_nil());
216-
};
218+
} (_, _, _, write_ptr_ptr, unit_ty, llunitsz);
217219

218-
let bcx = iter_ivec_raw(bcx, lhs, vec_ty, lhs_fill, copy_block).bcx;
219-
let bcx = iter_ivec_raw(bcx, rhs, vec_ty, rhs_fill, copy_block).bcx;
220+
let bcx = iter_ivec_raw(bcx, lhs, vec_ty, lhs_fill, copy_fn).bcx;
221+
let bcx = iter_ivec_raw(bcx, rhs, vec_ty, rhs_fill, copy_fn).bcx;
220222
ret rslt(bcx, new_vec);
221223
}
222224

0 commit comments

Comments
 (0)