diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-06-07 10:04:31 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-06-07 10:04:31 +0300 |
| commit | 02cbc0ef8ce62ca2c903052fdf13e33af152a38d (patch) | |
| tree | dff2ef5dc4403690f1926df42af245453831ad28 /src | |
| parent | 11e31091a9e7e3604d79d9e820067120945c538d (diff) | |
| download | rust-02cbc0ef8ce62ca2c903052fdf13e33af152a38d.tar.gz rust-02cbc0ef8ce62ca2c903052fdf13e33af152a38d.zip | |
trans: don't create allocas anywhere other than the entry block.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_trans/mir/block.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index b7aca4c8d7f..56bf803fcd8 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -894,8 +894,11 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> { // bitcasting to the struct type yields invalid cast errors. // We instead thus allocate some scratch space... - let llscratch = bcx.alloca(llcast_ty, "fn_ret_cast"); - bcx.with_block(|bcx| base::call_lifetime_start(bcx, llscratch)); + let llscratch = bcx.with_block(|bcx| { + let alloca = base::alloca(bcx, llcast_ty, "fn_ret_cast"); + base::call_lifetime_start(bcx, alloca); + alloca + }); // ...where we first store the value... bcx.store(op.immediate(), llscratch); |
