@@ -11,7 +11,7 @@ use rustc_data_structures::fx::FxHashSet;
11
11
use rustc_hir as hir;
12
12
use rustc_hir:: def_id:: DefId ;
13
13
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 } ;
15
15
use rustc_index:: vec:: Idx ;
16
16
use rustc_middle:: middle:: region:: * ;
17
17
use rustc_middle:: ty:: query:: Providers ;
@@ -185,7 +185,7 @@ fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir
185
185
}
186
186
187
187
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 ;
189
189
debug ! ( "resolve_stmt(stmt.id={:?})" , stmt_id) ;
190
190
191
191
// Every statement will clean up the temporaries created during
@@ -196,6 +196,7 @@ fn resolve_stmt<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx h
196
196
visitor. terminating_scopes . insert ( stmt_id) ;
197
197
198
198
let prev_parent = visitor. cx . parent ;
199
+ visitor. enter_node_scope_with_dtor ( stmt_id) ;
199
200
200
201
intravisit:: walk_stmt ( visitor, stmt) ;
201
202
@@ -432,7 +433,6 @@ fn resolve_local<'tcx>(
432
433
visitor : & mut RegionResolutionVisitor < ' tcx > ,
433
434
pat : Option < & ' tcx hir:: Pat < ' tcx > > ,
434
435
init : Option < & ' tcx hir:: Expr < ' tcx > > ,
435
- local_hir_id : Option < HirId > ,
436
436
) {
437
437
debug ! ( "resolve_local(pat={:?}, init={:?})" , pat, init) ;
438
438
@@ -494,10 +494,6 @@ fn resolve_local<'tcx>(
494
494
// A, but the inner rvalues `a()` and `b()` have an extended lifetime
495
495
// due to rule C.
496
496
497
- if let Some ( hir_id) = local_hir_id {
498
- visitor. enter_node_scope_with_dtor ( hir_id. local_id ) ;
499
- }
500
-
501
497
if let Some ( expr) = init {
502
498
record_rvalue_scope_if_borrow_expr ( visitor, & expr, blk_scope) ;
503
499
@@ -772,7 +768,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
772
768
// (i.e., `'static`), which means that after `g` returns, it drops,
773
769
// and all the associated destruction scope rules apply.
774
770
self . cx . var_parent = None ;
775
- resolve_local ( self , None , Some ( & body. value ) , None ) ;
771
+ resolve_local ( self , None , Some ( & body. value ) ) ;
776
772
}
777
773
778
774
if body. generator_kind . is_some ( ) {
@@ -799,7 +795,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
799
795
resolve_expr ( self , ex) ;
800
796
}
801
797
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 ( ) ) ;
803
799
}
804
800
}
805
801
0 commit comments