diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index da375e791bc4b..bde5f58618f82 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -97,12 +97,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ExprKind::Box { value } => { let value = this.hir.mirror(value); let result = this.temp(expr.ty, expr_span); + this.cfg.push(block, Statement { + source_info, + kind: StatementKind::StorageLive(result.clone()) + }); if let Some(scope) = scope { // schedule a shallow free of that memory, lest we unwind: - this.cfg.push(block, Statement { - source_info, - kind: StatementKind::StorageLive(result.clone()) - }); this.schedule_drop(expr_span, scope, &result, value.ty); } diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index 4f248ddb0e2cf..22ae81217e56f 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -50,7 +50,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let expr_ty = expr.ty.clone(); let temp = this.temp(expr_ty.clone(), expr_span); - if !expr_ty.is_never() && temp_lifetime.is_some() { + if !expr_ty.is_never() { this.cfg.push(block, Statement { source_info, kind: StatementKind::StorageLive(temp.clone())