@@ -67,7 +67,7 @@ struct RegionResolutionVisitor<'tcx> {
67
67
/// arbitrary amounts of stack space. Terminating scopes end
68
68
/// up being contained in a DestructionScope that contains the
69
69
/// destructor's execution.
70
- terminating_scopes : FxHashSet < ( hir:: ItemLocalId , bool ) > ,
70
+ terminating_scopes : FxHashSet < hir:: ItemLocalId > ,
71
71
}
72
72
73
73
/// Records the lifetime of a local variable as `cx.var_parent`
@@ -116,7 +116,7 @@ fn resolve_block<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, blk: &'tcx h
116
116
// `other_argument()` has run and also the call to `quux(..)`
117
117
// itself has returned.
118
118
119
- visitor. enter_node_scope_with_dtor ( blk. hir_id . local_id , false ) ;
119
+ visitor. enter_node_scope_with_dtor ( blk. hir_id . local_id ) ;
120
120
visitor. cx . var_parent = visitor. cx . parent ;
121
121
122
122
{
@@ -157,10 +157,10 @@ fn resolve_arm<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, arm: &'tcx hir
157
157
visitor. enter_scope ( Scope { id : arm. hir_id . local_id , data : ScopeData :: Node , for_stmt : false } ) ;
158
158
visitor. cx . var_parent = visitor. cx . parent ;
159
159
160
- visitor. terminating_scopes . insert ( ( arm. body . hir_id . local_id , false ) ) ;
160
+ visitor. terminating_scopes . insert ( arm. body . hir_id . local_id ) ;
161
161
162
162
if let Some ( hir:: Guard :: If ( ref expr) ) = arm. guard {
163
- visitor. terminating_scopes . insert ( ( expr. hir_id . local_id , false ) ) ;
163
+ visitor. terminating_scopes . insert ( expr. hir_id . local_id ) ;
164
164
}
165
165
166
166
intravisit:: walk_arm ( visitor, arm) ;
@@ -203,9 +203,9 @@ fn resolve_stmt<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, stmt: &'tcx h
203
203
204
204
match & stmt. kind {
205
205
kind @ ( hir:: StmtKind :: Local ( _) | hir:: StmtKind :: Expr ( _) | hir:: StmtKind :: Semi ( _) ) => {
206
- let local_id = kind. hir_id ( ) . local_id ;
207
- visitor. terminating_scopes . insert ( ( local_id , true ) ) ;
208
- visitor. enter_node_scope_with_dtor ( local_id , true ) ;
206
+ let id = kind. hir_id ( ) . local_id ;
207
+ visitor. enter_scope ( Scope { id , data : ScopeData :: Destruction , for_stmt : true } ) ;
208
+ visitor. enter_scope ( Scope { id , data : ScopeData :: Node , for_stmt : true } ) ;
209
209
}
210
210
hir:: StmtKind :: Item ( _) => { }
211
211
}
@@ -219,12 +219,12 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
219
219
debug ! ( "resolve_expr - pre-increment {} expr = {:?}" , visitor. expr_and_pat_count, expr) ;
220
220
221
221
let prev_cx = visitor. cx ;
222
- visitor. enter_node_scope_with_dtor ( expr. hir_id . local_id , false ) ;
222
+ visitor. enter_node_scope_with_dtor ( expr. hir_id . local_id ) ;
223
223
224
224
{
225
225
let terminating_scopes = & mut visitor. terminating_scopes ;
226
226
let mut terminating = |id : hir:: ItemLocalId | {
227
- terminating_scopes. insert ( ( id , false ) ) ;
227
+ terminating_scopes. insert ( id ) ;
228
228
} ;
229
229
match expr. kind {
230
230
// Conditional or repeating scopes are always terminating
@@ -699,15 +699,15 @@ impl<'tcx> RegionResolutionVisitor<'tcx> {
699
699
self . cx . parent = Some ( ( child_scope, child_depth) ) ;
700
700
}
701
701
702
- fn enter_node_scope_with_dtor ( & mut self , id : hir:: ItemLocalId , for_stmt : bool ) {
702
+ fn enter_node_scope_with_dtor ( & mut self , id : hir:: ItemLocalId ) {
703
703
// If node was previously marked as a terminating scope during the
704
704
// recursive visit of its parent node in the AST, then we need to
705
705
// account for the destruction scope representing the scope of
706
706
// the destructors that run immediately after it completes.
707
- if self . terminating_scopes . contains ( & ( id , for_stmt ) ) {
708
- self . enter_scope ( Scope { id, data : ScopeData :: Destruction , for_stmt } ) ;
707
+ if self . terminating_scopes . contains ( & id ) {
708
+ self . enter_scope ( Scope { id, data : ScopeData :: Destruction , for_stmt : false } ) ;
709
709
}
710
- self . enter_scope ( Scope { id, data : ScopeData :: Node , for_stmt } ) ;
710
+ self . enter_scope ( Scope { id, data : ScopeData :: Node , for_stmt : false } ) ;
711
711
}
712
712
}
713
713
@@ -745,7 +745,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
745
745
// control flow assumptions. This doesn't apply to nested
746
746
// bodies within the `+=` statements. See #69307.
747
747
let outer_pessimistic_yield = mem:: replace ( & mut self . pessimistic_yield , false ) ;
748
- self . terminating_scopes . insert ( ( body. value . hir_id . local_id , false ) ) ;
748
+ self . terminating_scopes . insert ( body. value . hir_id . local_id ) ;
749
749
750
750
self . enter_scope ( Scope {
751
751
id : body. value . hir_id . local_id ,
0 commit comments