@@ -39,10 +39,10 @@ use crate::{
3939
4040type Res = def:: Res < NodeId > ;
4141
42- impl < ' a , Id : Into < DefId > > ToNameBinding < ' a >
43- for ( Module < ' a > , ty:: Visibility < Id > , Span , LocalExpnId )
42+ impl < ' rslv , Id : Into < DefId > > ToNameBinding < ' rslv >
43+ for ( Module < ' rslv > , ty:: Visibility < Id > , Span , LocalExpnId )
4444{
45- fn to_name_binding ( self , arenas : & ' a ResolverArenas < ' a > ) -> NameBinding < ' a > {
45+ fn to_name_binding ( self , arenas : & ' rslv ResolverArenas < ' rslv > ) -> NameBinding < ' rslv > {
4646 arenas. alloc_name_binding ( NameBindingData {
4747 kind : NameBindingKind :: Module ( self . 0 ) ,
4848 ambiguity : None ,
@@ -54,8 +54,8 @@ impl<'a, Id: Into<DefId>> ToNameBinding<'a>
5454 }
5555}
5656
57- impl < ' a , Id : Into < DefId > > ToNameBinding < ' a > for ( Res , ty:: Visibility < Id > , Span , LocalExpnId ) {
58- fn to_name_binding ( self , arenas : & ' a ResolverArenas < ' a > ) -> NameBinding < ' a > {
57+ impl < ' rslv , Id : Into < DefId > > ToNameBinding < ' rslv > for ( Res , ty:: Visibility < Id > , Span , LocalExpnId ) {
58+ fn to_name_binding ( self , arenas : & ' rslv ResolverArenas < ' rslv > ) -> NameBinding < ' rslv > {
5959 arenas. alloc_name_binding ( NameBindingData {
6060 kind : NameBindingKind :: Res ( self . 0 ) ,
6161 ambiguity : None ,
@@ -67,12 +67,12 @@ impl<'a, Id: Into<DefId>> ToNameBinding<'a> for (Res, ty::Visibility<Id>, Span,
6767 }
6868}
6969
70- impl < ' a , ' tcx > Resolver < ' a , ' tcx > {
70+ impl < ' rslv , ' tcx > Resolver < ' rslv , ' tcx > {
7171 /// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined;
7272 /// otherwise, reports an error.
73- pub ( crate ) fn define < T > ( & mut self , parent : Module < ' a > , ident : Ident , ns : Namespace , def : T )
73+ pub ( crate ) fn define < T > ( & mut self , parent : Module < ' rslv > , ident : Ident , ns : Namespace , def : T )
7474 where
75- T : ToNameBinding < ' a > ,
75+ T : ToNameBinding < ' rslv > ,
7676 {
7777 let binding = def. to_name_binding ( self . arenas ) ;
7878 let key = self . new_disambiguated_key ( ident, ns) ;
@@ -97,7 +97,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
9797 /// Reachable macros with block module parents exist due to `#[macro_export] macro_rules!`,
9898 /// but they cannot use def-site hygiene, so the assumption holds
9999 /// (<https://github.com/rust-lang/rust/pull/77984#issuecomment-712445508>).
100- pub ( crate ) fn get_nearest_non_block_module ( & mut self , mut def_id : DefId ) -> Module < ' a > {
100+ pub ( crate ) fn get_nearest_non_block_module ( & mut self , mut def_id : DefId ) -> Module < ' rslv > {
101101 loop {
102102 match self . get_module ( def_id) {
103103 Some ( module) => return module,
@@ -106,14 +106,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
106106 }
107107 }
108108
109- pub ( crate ) fn expect_module ( & mut self , def_id : DefId ) -> Module < ' a > {
109+ pub ( crate ) fn expect_module ( & mut self , def_id : DefId ) -> Module < ' rslv > {
110110 self . get_module ( def_id) . expect ( "argument `DefId` is not a module" )
111111 }
112112
113113 /// If `def_id` refers to a module (in resolver's sense, i.e. a module item, crate root, enum,
114114 /// or trait), then this function returns that module's resolver representation, otherwise it
115115 /// returns `None`.
116- pub ( crate ) fn get_module ( & mut self , def_id : DefId ) -> Option < Module < ' a > > {
116+ pub ( crate ) fn get_module ( & mut self , def_id : DefId ) -> Option < Module < ' rslv > > {
117117 if let module @ Some ( ..) = self . module_map . get ( & def_id) {
118118 return module. copied ( ) ;
119119 }
@@ -143,7 +143,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
143143 None
144144 }
145145
146- pub ( crate ) fn expn_def_scope ( & mut self , expn_id : ExpnId ) -> Module < ' a > {
146+ pub ( crate ) fn expn_def_scope ( & mut self , expn_id : ExpnId ) -> Module < ' rslv > {
147147 match expn_id. expn_data ( ) . macro_def_id {
148148 Some ( def_id) => self . macro_def_scope ( def_id) ,
149149 None => expn_id
@@ -153,7 +153,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
153153 }
154154 }
155155
156- pub ( crate ) fn macro_def_scope ( & mut self , def_id : DefId ) -> Module < ' a > {
156+ pub ( crate ) fn macro_def_scope ( & mut self , def_id : DefId ) -> Module < ' rslv > {
157157 if let Some ( id) = def_id. as_local ( ) {
158158 self . local_macro_def_scopes [ & id]
159159 } else {
@@ -186,15 +186,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
186186 pub ( crate ) fn build_reduced_graph (
187187 & mut self ,
188188 fragment : & AstFragment ,
189- parent_scope : ParentScope < ' a > ,
190- ) -> MacroRulesScopeRef < ' a > {
189+ parent_scope : ParentScope < ' rslv > ,
190+ ) -> MacroRulesScopeRef < ' rslv > {
191191 collect_definitions ( self , fragment, parent_scope. expansion ) ;
192192 let mut visitor = BuildReducedGraphVisitor { r : self , parent_scope } ;
193193 fragment. visit_with ( & mut visitor) ;
194194 visitor. parent_scope . macro_rules
195195 }
196196
197- pub ( crate ) fn build_reduced_graph_external ( & mut self , module : Module < ' a > ) {
197+ pub ( crate ) fn build_reduced_graph_external ( & mut self , module : Module < ' rslv > ) {
198198 for child in self . tcx . module_children ( module. def_id ( ) ) {
199199 let parent_scope = ParentScope :: module ( module, self ) ;
200200 self . build_reduced_graph_for_external_crate_res ( child, parent_scope)
@@ -205,7 +205,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
205205 fn build_reduced_graph_for_external_crate_res (
206206 & mut self ,
207207 child : & ModChild ,
208- parent_scope : ParentScope < ' a > ,
208+ parent_scope : ParentScope < ' rslv > ,
209209 ) {
210210 let parent = parent_scope. module ;
211211 let ModChild { ident, res, vis, ref reexport_chain } = * child;
@@ -273,18 +273,18 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
273273 }
274274}
275275
276- struct BuildReducedGraphVisitor < ' a , ' b , ' tcx > {
277- r : & ' b mut Resolver < ' a , ' tcx > ,
278- parent_scope : ParentScope < ' a > ,
276+ struct BuildReducedGraphVisitor < ' a , ' rslv , ' tcx > {
277+ r : & ' a mut Resolver < ' rslv , ' tcx > ,
278+ parent_scope : ParentScope < ' rslv > ,
279279}
280280
281- impl < ' a , ' tcx > AsMut < Resolver < ' a , ' tcx > > for BuildReducedGraphVisitor < ' a , ' _ , ' tcx > {
282- fn as_mut ( & mut self ) -> & mut Resolver < ' a , ' tcx > {
281+ impl < ' rslv , ' tcx > AsMut < Resolver < ' rslv , ' tcx > > for BuildReducedGraphVisitor < ' _ , ' rslv , ' tcx > {
282+ fn as_mut ( & mut self ) -> & mut Resolver < ' rslv , ' tcx > {
283283 self . r
284284 }
285285}
286286
287- impl < ' a , ' b , ' tcx > BuildReducedGraphVisitor < ' a , ' b , ' tcx > {
287+ impl < ' a , ' rslv , ' tcx > BuildReducedGraphVisitor < ' a , ' rslv , ' tcx > {
288288 fn res ( & self , def_id : impl Into < DefId > ) -> Res {
289289 let def_id = def_id. into ( ) ;
290290 Res :: Def ( self . r . tcx . def_kind ( def_id) , def_id)
@@ -424,7 +424,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
424424 fn add_import (
425425 & mut self ,
426426 module_path : Vec < Segment > ,
427- kind : ImportKind < ' a > ,
427+ kind : ImportKind < ' rslv > ,
428428 span : Span ,
429429 item : & ast:: Item ,
430430 root_span : Span ,
@@ -752,7 +752,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
752752 }
753753
754754 /// Constructs the reduced graph for one item.
755- fn build_reduced_graph_for_item ( & mut self , item : & ' b Item ) {
755+ fn build_reduced_graph_for_item ( & mut self , item : & ' a Item ) {
756756 let parent_scope = & self . parent_scope ;
757757 let parent = parent_scope. module ;
758758 let expansion = parent_scope. expansion ;
@@ -918,7 +918,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
918918 item : & Item ,
919919 local_def_id : LocalDefId ,
920920 vis : ty:: Visibility ,
921- parent : Module < ' a > ,
921+ parent : Module < ' rslv > ,
922922 ) {
923923 let ident = item. ident ;
924924 let sp = item. span ;
@@ -1040,7 +1040,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
10401040 fn add_macro_use_binding (
10411041 & mut self ,
10421042 name : Symbol ,
1043- binding : NameBinding < ' a > ,
1043+ binding : NameBinding < ' rslv > ,
10441044 span : Span ,
10451045 allow_shadowing : bool ,
10461046 ) {
@@ -1050,7 +1050,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
10501050 }
10511051
10521052 /// Returns `true` if we should consider the underlying `extern crate` to be used.
1053- fn process_macro_use_imports ( & mut self , item : & Item , module : Module < ' a > ) -> bool {
1053+ fn process_macro_use_imports ( & mut self , item : & Item , module : Module < ' rslv > ) -> bool {
10541054 let mut import_all = None ;
10551055 let mut single_imports = Vec :: new ( ) ;
10561056 for attr in & item. attrs {
@@ -1188,7 +1188,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
11881188
11891189 /// Visit invocation in context in which it can emit a named item (possibly `macro_rules`)
11901190 /// directly into its parent scope's module.
1191- fn visit_invoc_in_module ( & mut self , id : NodeId ) -> MacroRulesScopeRef < ' a > {
1191+ fn visit_invoc_in_module ( & mut self , id : NodeId ) -> MacroRulesScopeRef < ' rslv > {
11921192 let invoc_id = self . visit_invoc ( id) ;
11931193 self . parent_scope . module . unexpanded_invocations . borrow_mut ( ) . insert ( invoc_id) ;
11941194 self . r . arenas . alloc_macro_rules_scope ( MacroRulesScope :: Invocation ( invoc_id) )
@@ -1221,7 +1221,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
12211221 }
12221222 }
12231223
1224- fn define_macro ( & mut self , item : & ast:: Item ) -> MacroRulesScopeRef < ' a > {
1224+ fn define_macro ( & mut self , item : & ast:: Item ) -> MacroRulesScopeRef < ' rslv > {
12251225 let parent_scope = self . parent_scope ;
12261226 let expansion = parent_scope. expansion ;
12271227 let feed = self . r . feed ( item. id ) ;
@@ -1308,7 +1308,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
13081308
13091309macro_rules! method {
13101310 ( $visit: ident: $ty: ty, $invoc: path, $walk: ident) => {
1311- fn $visit( & mut self , node: & ' b $ty) {
1311+ fn $visit( & mut self , node: & ' a $ty) {
13121312 if let $invoc( ..) = node. kind {
13131313 self . visit_invoc( node. id) ;
13141314 } else {
@@ -1318,12 +1318,12 @@ macro_rules! method {
13181318 } ;
13191319}
13201320
1321- impl < ' a , ' b , ' tcx > Visitor < ' b > for BuildReducedGraphVisitor < ' a , ' b , ' tcx > {
1321+ impl < ' a , ' rslv , ' tcx > Visitor < ' a > for BuildReducedGraphVisitor < ' a , ' rslv , ' tcx > {
13221322 method ! ( visit_expr: ast:: Expr , ast:: ExprKind :: MacCall , walk_expr) ;
13231323 method ! ( visit_pat: ast:: Pat , ast:: PatKind :: MacCall , walk_pat) ;
13241324 method ! ( visit_ty: ast:: Ty , ast:: TyKind :: MacCall , walk_ty) ;
13251325
1326- fn visit_item ( & mut self , item : & ' b Item ) {
1326+ fn visit_item ( & mut self , item : & ' a Item ) {
13271327 let orig_module_scope = self . parent_scope . module ;
13281328 self . parent_scope . macro_rules = match item. kind {
13291329 ItemKind :: MacroDef ( ..) => {
@@ -1357,15 +1357,15 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
13571357 self . parent_scope . module = orig_module_scope;
13581358 }
13591359
1360- fn visit_stmt ( & mut self , stmt : & ' b ast:: Stmt ) {
1360+ fn visit_stmt ( & mut self , stmt : & ' a ast:: Stmt ) {
13611361 if let ast:: StmtKind :: MacCall ( ..) = stmt. kind {
13621362 self . parent_scope . macro_rules = self . visit_invoc_in_module ( stmt. id ) ;
13631363 } else {
13641364 visit:: walk_stmt ( self , stmt) ;
13651365 }
13661366 }
13671367
1368- fn visit_foreign_item ( & mut self , foreign_item : & ' b ForeignItem ) {
1368+ fn visit_foreign_item ( & mut self , foreign_item : & ' a ForeignItem ) {
13691369 if let ForeignItemKind :: MacCall ( _) = foreign_item. kind {
13701370 self . visit_invoc_in_module ( foreign_item. id ) ;
13711371 return ;
@@ -1375,7 +1375,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
13751375 visit:: walk_item ( self , foreign_item) ;
13761376 }
13771377
1378- fn visit_block ( & mut self , block : & ' b Block ) {
1378+ fn visit_block ( & mut self , block : & ' a Block ) {
13791379 let orig_current_module = self . parent_scope . module ;
13801380 let orig_current_macro_rules_scope = self . parent_scope . macro_rules ;
13811381 self . build_reduced_graph_for_block ( block) ;
@@ -1384,7 +1384,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
13841384 self . parent_scope . macro_rules = orig_current_macro_rules_scope;
13851385 }
13861386
1387- fn visit_assoc_item ( & mut self , item : & ' b AssocItem , ctxt : AssocCtxt ) {
1387+ fn visit_assoc_item ( & mut self , item : & ' a AssocItem , ctxt : AssocCtxt ) {
13881388 if let AssocItemKind :: MacCall ( _) = item. kind {
13891389 match ctxt {
13901390 AssocCtxt :: Trait => {
@@ -1440,7 +1440,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
14401440 visit:: walk_assoc_item ( self , item, ctxt) ;
14411441 }
14421442
1443- fn visit_attribute ( & mut self , attr : & ' b ast:: Attribute ) {
1443+ fn visit_attribute ( & mut self , attr : & ' a ast:: Attribute ) {
14441444 if !attr. is_doc_comment ( ) && attr:: is_builtin_attr ( attr) {
14451445 self . r
14461446 . builtin_attrs
@@ -1449,47 +1449,47 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
14491449 visit:: walk_attribute ( self , attr) ;
14501450 }
14511451
1452- fn visit_arm ( & mut self , arm : & ' b ast:: Arm ) {
1452+ fn visit_arm ( & mut self , arm : & ' a ast:: Arm ) {
14531453 if arm. is_placeholder {
14541454 self . visit_invoc ( arm. id ) ;
14551455 } else {
14561456 visit:: walk_arm ( self , arm) ;
14571457 }
14581458 }
14591459
1460- fn visit_expr_field ( & mut self , f : & ' b ast:: ExprField ) {
1460+ fn visit_expr_field ( & mut self , f : & ' a ast:: ExprField ) {
14611461 if f. is_placeholder {
14621462 self . visit_invoc ( f. id ) ;
14631463 } else {
14641464 visit:: walk_expr_field ( self , f) ;
14651465 }
14661466 }
14671467
1468- fn visit_pat_field ( & mut self , fp : & ' b ast:: PatField ) {
1468+ fn visit_pat_field ( & mut self , fp : & ' a ast:: PatField ) {
14691469 if fp. is_placeholder {
14701470 self . visit_invoc ( fp. id ) ;
14711471 } else {
14721472 visit:: walk_pat_field ( self , fp) ;
14731473 }
14741474 }
14751475
1476- fn visit_generic_param ( & mut self , param : & ' b ast:: GenericParam ) {
1476+ fn visit_generic_param ( & mut self , param : & ' a ast:: GenericParam ) {
14771477 if param. is_placeholder {
14781478 self . visit_invoc ( param. id ) ;
14791479 } else {
14801480 visit:: walk_generic_param ( self , param) ;
14811481 }
14821482 }
14831483
1484- fn visit_param ( & mut self , p : & ' b ast:: Param ) {
1484+ fn visit_param ( & mut self , p : & ' a ast:: Param ) {
14851485 if p. is_placeholder {
14861486 self . visit_invoc ( p. id ) ;
14871487 } else {
14881488 visit:: walk_param ( self , p) ;
14891489 }
14901490 }
14911491
1492- fn visit_field_def ( & mut self , sf : & ' b ast:: FieldDef ) {
1492+ fn visit_field_def ( & mut self , sf : & ' a ast:: FieldDef ) {
14931493 if sf. is_placeholder {
14941494 self . visit_invoc ( sf. id ) ;
14951495 } else {
@@ -1501,7 +1501,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
15011501
15021502 // Constructs the reduced graph for one variant. Variants exist in the
15031503 // type and value namespaces.
1504- fn visit_variant ( & mut self , variant : & ' b ast:: Variant ) {
1504+ fn visit_variant ( & mut self , variant : & ' a ast:: Variant ) {
15051505 if variant. is_placeholder {
15061506 self . visit_invoc_in_module ( variant. id ) ;
15071507 return ;
@@ -1542,7 +1542,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
15421542 visit:: walk_variant ( self , variant) ;
15431543 }
15441544
1545- fn visit_crate ( & mut self , krate : & ' b ast:: Crate ) {
1545+ fn visit_crate ( & mut self , krate : & ' a ast:: Crate ) {
15461546 if krate. is_placeholder {
15471547 self . visit_invoc_in_module ( krate. id ) ;
15481548 } else {
0 commit comments