1
Fork 0

rustc_mir: always emit StorageLive even without a matching StorageDead.

This commit is contained in:
Eduard-Mihai Burtescu 2017-09-01 22:53:54 +03:00
parent dc563efd98
commit 02ec0ae066
2 changed files with 5 additions and 5 deletions

View file

@ -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);
}

View file

@ -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())