Skip to content

Commit 97ab6d8

Browse files
committed
Undo some stuff
1 parent 5771bdb commit 97ab6d8

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compiler/rustc_passes/src/region.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
1111
use rustc_hir as hir;
1212
use rustc_hir::def_id::DefId;
1313
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
14-
use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt, HirId};
14+
use rustc_hir::{Arm, Block, Expr, Local, Node, Pat, PatKind, Stmt};
1515
use rustc_index::vec::Idx;
1616
use rustc_middle::middle::region::*;
1717
use rustc_middle::ty::query::Providers;
@@ -185,7 +185,7 @@ fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir
185185
}
186186

187187
fn resolve_stmt<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx hir::Stmt<'tcx>) {
188-
let stmt_id = stmt.kind.hir_id().local_id;
188+
let stmt_id = stmt.hir_id.local_id;
189189
debug!("resolve_stmt(stmt.id={:?})", stmt_id);
190190

191191
// Every statement will clean up the temporaries created during
@@ -196,6 +196,7 @@ fn resolve_stmt<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx h
196196
visitor.terminating_scopes.insert(stmt_id);
197197

198198
let prev_parent = visitor.cx.parent;
199+
visitor.enter_node_scope_with_dtor(stmt_id);
199200

200201
intravisit::walk_stmt(visitor, stmt);
201202

@@ -432,7 +433,6 @@ fn resolve_local<'tcx>(
432433
visitor: &mut RegionResolutionVisitor<'tcx>,
433434
pat: Option<&'tcx hir::Pat<'tcx>>,
434435
init: Option<&'tcx hir::Expr<'tcx>>,
435-
local_hir_id: Option<HirId>,
436436
) {
437437
debug!("resolve_local(pat={:?}, init={:?})", pat, init);
438438

@@ -494,10 +494,6 @@ fn resolve_local<'tcx>(
494494
// A, but the inner rvalues `a()` and `b()` have an extended lifetime
495495
// due to rule C.
496496

497-
if let Some(hir_id) = local_hir_id {
498-
visitor.enter_node_scope_with_dtor(hir_id.local_id);
499-
}
500-
501497
if let Some(expr) = init {
502498
record_rvalue_scope_if_borrow_expr(visitor, &expr, blk_scope);
503499

@@ -772,7 +768,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
772768
// (i.e., `'static`), which means that after `g` returns, it drops,
773769
// and all the associated destruction scope rules apply.
774770
self.cx.var_parent = None;
775-
resolve_local(self, None, Some(&body.value), None);
771+
resolve_local(self, None, Some(&body.value));
776772
}
777773

778774
if body.generator_kind.is_some() {
@@ -799,7 +795,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
799795
resolve_expr(self, ex);
800796
}
801797
fn visit_local(&mut self, l: &'tcx Local<'tcx>) {
802-
resolve_local(self, Some(&l.pat), l.init.as_deref(), Some(l.hir_id));
798+
resolve_local(self, Some(&l.pat), l.init.as_deref());
803799
}
804800
}
805801

0 commit comments

Comments
 (0)