@@ -64,7 +64,6 @@ use rustc_span::{Span, DUMMY_SP};
6464
6565use smallvec:: SmallVec ;
6666use std:: collections:: BTreeMap ;
67- use std:: mem;
6867use tracing:: { debug, trace} ;
6968
7069macro_rules! arena_vec {
@@ -117,8 +116,8 @@ struct LoweringContext<'a, 'hir: 'a> {
117116 /// outside of an `async fn`.
118117 current_item : Option < Span > ,
119118
120- catch_scopes : Vec < NodeId > ,
121- loop_scopes : Vec < NodeId > ,
119+ catch_scope : Option < NodeId > ,
120+ loop_scope : Option < NodeId > ,
122121 is_in_loop_condition : bool ,
123122 is_in_trait_impl : bool ,
124123 is_in_dyn_type : bool ,
@@ -323,8 +322,8 @@ pub fn lower_crate<'a, 'hir>(
323322 bodies : BTreeMap :: new ( ) ,
324323 modules : BTreeMap :: new ( ) ,
325324 attrs : BTreeMap :: default ( ) ,
326- catch_scopes : Vec :: new ( ) ,
327- loop_scopes : Vec :: new ( ) ,
325+ catch_scope : None ,
326+ loop_scope : None ,
328327 is_in_loop_condition : false ,
329328 is_in_trait_impl : false ,
330329 is_in_dyn_type : false ,
@@ -911,11 +910,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
911910 let was_in_loop_condition = self . is_in_loop_condition ;
912911 self . is_in_loop_condition = false ;
913912
914- let catch_scopes = mem :: take ( & mut self . catch_scopes ) ;
915- let loop_scopes = mem :: take ( & mut self . loop_scopes ) ;
913+ let catch_scope = self . catch_scope . take ( ) ;
914+ let loop_scope = self . loop_scope . take ( ) ;
916915 let ret = f ( self ) ;
917- self . catch_scopes = catch_scopes ;
918- self . loop_scopes = loop_scopes ;
916+ self . catch_scope = catch_scope ;
917+ self . loop_scope = loop_scope ;
919918
920919 self . is_in_loop_condition = was_in_loop_condition;
921920
0 commit comments