Skip to content

Commit

Permalink
rustc_mir: always emit StorageLive even without a matching StorageDead.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Sep 1, 2017
1 parent dc563ef commit 02ec0ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/librustc_mir/build/expr/as_rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/expr/as_temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 02ec0ae

Please sign in to comment.