Skip to content

Commit 02ec0ae

Browse files
committed
rustc_mir: always emit StorageLive even without a matching StorageDead.
1 parent dc563ef commit 02ec0ae

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_mir/build/expr/as_rvalue.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
9797
ExprKind::Box { value } => {
9898
let value = this.hir.mirror(value);
9999
let result = this.temp(expr.ty, expr_span);
100+
this.cfg.push(block, Statement {
101+
source_info,
102+
kind: StatementKind::StorageLive(result.clone())
103+
});
100104
if let Some(scope) = scope {
101105
// schedule a shallow free of that memory, lest we unwind:
102-
this.cfg.push(block, Statement {
103-
source_info,
104-
kind: StatementKind::StorageLive(result.clone())
105-
});
106106
this.schedule_drop(expr_span, scope, &result, value.ty);
107107
}
108108

src/librustc_mir/build/expr/as_temp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
5050
let expr_ty = expr.ty.clone();
5151
let temp = this.temp(expr_ty.clone(), expr_span);
5252

53-
if !expr_ty.is_never() && temp_lifetime.is_some() {
53+
if !expr_ty.is_never() {
5454
this.cfg.push(block, Statement {
5555
source_info,
5656
kind: StatementKind::StorageLive(temp.clone())

0 commit comments

Comments
 (0)