Skip to content

Commit 02cbc0e

Browse files
committed
trans: don't create allocas anywhere other than the entry block.
1 parent 11e3109 commit 02cbc0e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/librustc_trans/mir/block.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -894,8 +894,11 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
894894
// bitcasting to the struct type yields invalid cast errors.
895895

896896
// We instead thus allocate some scratch space...
897-
let llscratch = bcx.alloca(llcast_ty, "fn_ret_cast");
898-
bcx.with_block(|bcx| base::call_lifetime_start(bcx, llscratch));
897+
let llscratch = bcx.with_block(|bcx| {
898+
let alloca = base::alloca(bcx, llcast_ty, "fn_ret_cast");
899+
base::call_lifetime_start(bcx, alloca);
900+
alloca
901+
});
899902

900903
// ...where we first store the value...
901904
bcx.store(op.immediate(), llscratch);

0 commit comments

Comments
 (0)