77
88use crate :: def_collector:: collect_definitions;
99use crate :: imports:: { Import , ImportKind } ;
10- use crate :: macros:: { LegacyBinding , LegacyScope } ;
10+ use crate :: macros:: { MacroRulesBinding , MacroRulesScope } ;
1111use crate :: Namespace :: { self , MacroNS , TypeNS , ValueNS } ;
1212use crate :: { CrateLint , Determinacy , PathResult , ResolutionError , VisResolutionError } ;
1313use crate :: {
@@ -165,11 +165,11 @@ impl<'a> Resolver<'a> {
165165 & mut self ,
166166 fragment : & AstFragment ,
167167 parent_scope : ParentScope < ' a > ,
168- ) -> LegacyScope < ' a > {
168+ ) -> MacroRulesScope < ' a > {
169169 collect_definitions ( & mut self . definitions , fragment, parent_scope. expansion ) ;
170170 let mut visitor = BuildReducedGraphVisitor { r : self , parent_scope } ;
171171 fragment. visit_with ( & mut visitor) ;
172- visitor. parent_scope . legacy
172+ visitor. parent_scope . macro_rules
173173 }
174174
175175 crate fn build_reduced_graph_external ( & mut self , module : Module < ' a > ) {
@@ -1060,15 +1060,15 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
10601060 false
10611061 }
10621062
1063- fn visit_invoc ( & mut self , id : NodeId ) -> LegacyScope < ' a > {
1063+ fn visit_invoc ( & mut self , id : NodeId ) -> MacroRulesScope < ' a > {
10641064 let invoc_id = id. placeholder_to_expn_id ( ) ;
10651065
10661066 self . parent_scope . module . unexpanded_invocations . borrow_mut ( ) . insert ( invoc_id) ;
10671067
10681068 let old_parent_scope = self . r . invocation_parent_scopes . insert ( invoc_id, self . parent_scope ) ;
10691069 assert ! ( old_parent_scope. is_none( ) , "invocation data is reset for an invocation" ) ;
10701070
1071- LegacyScope :: Invocation ( invoc_id)
1071+ MacroRulesScope :: Invocation ( invoc_id)
10721072 }
10731073
10741074 fn proc_macro_stub ( item : & ast:: Item ) -> Option < ( MacroKind , Ident , Span ) > {
@@ -1095,7 +1095,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
10951095 }
10961096 }
10971097
1098- fn define_macro ( & mut self , item : & ast:: Item ) -> LegacyScope < ' a > {
1098+ fn define_macro ( & mut self , item : & ast:: Item ) -> MacroRulesScope < ' a > {
10991099 let parent_scope = self . parent_scope ;
11001100 let expansion = parent_scope. expansion ;
11011101 let ( ext, ident, span, macro_rules) = match & item. kind {
@@ -1108,7 +1108,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
11081108 self . r . proc_macro_stubs . insert ( item. id ) ;
11091109 ( self . r . dummy_ext ( macro_kind) , ident, span, false )
11101110 }
1111- None => return parent_scope. legacy ,
1111+ None => return parent_scope. macro_rules ,
11121112 } ,
11131113 _ => unreachable ! ( ) ,
11141114 } ;
@@ -1137,8 +1137,8 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
11371137 self . r . check_reserved_macro_name ( ident, res) ;
11381138 self . insert_unused_macro ( ident, item. id , span) ;
11391139 }
1140- LegacyScope :: Binding ( self . r . arenas . alloc_legacy_binding ( LegacyBinding {
1141- parent_legacy_scope : parent_scope. legacy ,
1140+ MacroRulesScope :: Binding ( self . r . arenas . alloc_macro_rules_binding ( MacroRulesBinding {
1141+ parent_macro_rules_scope : parent_scope. macro_rules ,
11421142 binding,
11431143 ident,
11441144 } ) )
@@ -1149,7 +1149,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
11491149 self . insert_unused_macro ( ident, item. id , span) ;
11501150 }
11511151 self . r . define ( module, ident, MacroNS , ( res, vis, span, expansion) ) ;
1152- self . parent_scope . legacy
1152+ self . parent_scope . macro_rules
11531153 }
11541154 }
11551155}
@@ -1174,29 +1174,29 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
11741174 fn visit_item ( & mut self , item : & ' b Item ) {
11751175 let macro_use = match item. kind {
11761176 ItemKind :: MacroDef ( ..) => {
1177- self . parent_scope . legacy = self . define_macro ( item) ;
1177+ self . parent_scope . macro_rules = self . define_macro ( item) ;
11781178 return ;
11791179 }
11801180 ItemKind :: MacCall ( ..) => {
1181- self . parent_scope . legacy = self . visit_invoc ( item. id ) ;
1181+ self . parent_scope . macro_rules = self . visit_invoc ( item. id ) ;
11821182 return ;
11831183 }
11841184 ItemKind :: Mod ( ..) => self . contains_macro_use ( & item. attrs ) ,
11851185 _ => false ,
11861186 } ;
11871187 let orig_current_module = self . parent_scope . module ;
1188- let orig_current_legacy_scope = self . parent_scope . legacy ;
1188+ let orig_current_macro_rules_scope = self . parent_scope . macro_rules ;
11891189 self . build_reduced_graph_for_item ( item) ;
11901190 visit:: walk_item ( self , item) ;
11911191 self . parent_scope . module = orig_current_module;
11921192 if !macro_use {
1193- self . parent_scope . legacy = orig_current_legacy_scope ;
1193+ self . parent_scope . macro_rules = orig_current_macro_rules_scope ;
11941194 }
11951195 }
11961196
11971197 fn visit_stmt ( & mut self , stmt : & ' b ast:: Stmt ) {
11981198 if let ast:: StmtKind :: MacCall ( ..) = stmt. kind {
1199- self . parent_scope . legacy = self . visit_invoc ( stmt. id ) ;
1199+ self . parent_scope . macro_rules = self . visit_invoc ( stmt. id ) ;
12001200 } else {
12011201 visit:: walk_stmt ( self , stmt) ;
12021202 }
@@ -1214,11 +1214,11 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
12141214
12151215 fn visit_block ( & mut self , block : & ' b Block ) {
12161216 let orig_current_module = self . parent_scope . module ;
1217- let orig_current_legacy_scope = self . parent_scope . legacy ;
1217+ let orig_current_macro_rules_scope = self . parent_scope . macro_rules ;
12181218 self . build_reduced_graph_for_block ( block) ;
12191219 visit:: walk_block ( self , block) ;
12201220 self . parent_scope . module = orig_current_module;
1221- self . parent_scope . legacy = orig_current_legacy_scope ;
1221+ self . parent_scope . macro_rules = orig_current_macro_rules_scope ;
12221222 }
12231223
12241224 fn visit_assoc_item ( & mut self , item : & ' b AssocItem , ctxt : AssocCtxt ) {
0 commit comments