7
7
8
8
use crate :: def_collector:: collect_definitions;
9
9
use crate :: imports:: { Import , ImportKind } ;
10
- use crate :: macros:: { LegacyBinding , LegacyScope } ;
10
+ use crate :: macros:: { MacroRulesBinding , MacroRulesScope } ;
11
11
use crate :: Namespace :: { self , MacroNS , TypeNS , ValueNS } ;
12
12
use crate :: { CrateLint , Determinacy , PathResult , ResolutionError , VisResolutionError } ;
13
13
use crate :: {
@@ -165,11 +165,11 @@ impl<'a> Resolver<'a> {
165
165
& mut self ,
166
166
fragment : & AstFragment ,
167
167
parent_scope : ParentScope < ' a > ,
168
- ) -> LegacyScope < ' a > {
168
+ ) -> MacroRulesScope < ' a > {
169
169
collect_definitions ( & mut self . definitions , fragment, parent_scope. expansion ) ;
170
170
let mut visitor = BuildReducedGraphVisitor { r : self , parent_scope } ;
171
171
fragment. visit_with ( & mut visitor) ;
172
- visitor. parent_scope . legacy
172
+ visitor. parent_scope . macro_rules
173
173
}
174
174
175
175
crate fn build_reduced_graph_external ( & mut self , module : Module < ' a > ) {
@@ -1060,15 +1060,15 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
1060
1060
false
1061
1061
}
1062
1062
1063
- fn visit_invoc ( & mut self , id : NodeId ) -> LegacyScope < ' a > {
1063
+ fn visit_invoc ( & mut self , id : NodeId ) -> MacroRulesScope < ' a > {
1064
1064
let invoc_id = id. placeholder_to_expn_id ( ) ;
1065
1065
1066
1066
self . parent_scope . module . unexpanded_invocations . borrow_mut ( ) . insert ( invoc_id) ;
1067
1067
1068
1068
let old_parent_scope = self . r . invocation_parent_scopes . insert ( invoc_id, self . parent_scope ) ;
1069
1069
assert ! ( old_parent_scope. is_none( ) , "invocation data is reset for an invocation" ) ;
1070
1070
1071
- LegacyScope :: Invocation ( invoc_id)
1071
+ MacroRulesScope :: Invocation ( invoc_id)
1072
1072
}
1073
1073
1074
1074
fn proc_macro_stub ( item : & ast:: Item ) -> Option < ( MacroKind , Ident , Span ) > {
@@ -1095,7 +1095,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
1095
1095
}
1096
1096
}
1097
1097
1098
- fn define_macro ( & mut self , item : & ast:: Item ) -> LegacyScope < ' a > {
1098
+ fn define_macro ( & mut self , item : & ast:: Item ) -> MacroRulesScope < ' a > {
1099
1099
let parent_scope = self . parent_scope ;
1100
1100
let expansion = parent_scope. expansion ;
1101
1101
let ( ext, ident, span, macro_rules) = match & item. kind {
@@ -1108,7 +1108,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
1108
1108
self . r . proc_macro_stubs . insert ( item. id ) ;
1109
1109
( self . r . dummy_ext ( macro_kind) , ident, span, false )
1110
1110
}
1111
- None => return parent_scope. legacy ,
1111
+ None => return parent_scope. macro_rules ,
1112
1112
} ,
1113
1113
_ => unreachable ! ( ) ,
1114
1114
} ;
@@ -1137,8 +1137,8 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
1137
1137
self . r . check_reserved_macro_name ( ident, res) ;
1138
1138
self . insert_unused_macro ( ident, item. id , span) ;
1139
1139
}
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 ,
1142
1142
binding,
1143
1143
ident,
1144
1144
} ) )
@@ -1149,7 +1149,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
1149
1149
self . insert_unused_macro ( ident, item. id , span) ;
1150
1150
}
1151
1151
self . r . define ( module, ident, MacroNS , ( res, vis, span, expansion) ) ;
1152
- self . parent_scope . legacy
1152
+ self . parent_scope . macro_rules
1153
1153
}
1154
1154
}
1155
1155
}
@@ -1174,29 +1174,29 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
1174
1174
fn visit_item ( & mut self , item : & ' b Item ) {
1175
1175
let macro_use = match item. kind {
1176
1176
ItemKind :: MacroDef ( ..) => {
1177
- self . parent_scope . legacy = self . define_macro ( item) ;
1177
+ self . parent_scope . macro_rules = self . define_macro ( item) ;
1178
1178
return ;
1179
1179
}
1180
1180
ItemKind :: MacCall ( ..) => {
1181
- self . parent_scope . legacy = self . visit_invoc ( item. id ) ;
1181
+ self . parent_scope . macro_rules = self . visit_invoc ( item. id ) ;
1182
1182
return ;
1183
1183
}
1184
1184
ItemKind :: Mod ( ..) => self . contains_macro_use ( & item. attrs ) ,
1185
1185
_ => false ,
1186
1186
} ;
1187
1187
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 ;
1189
1189
self . build_reduced_graph_for_item ( item) ;
1190
1190
visit:: walk_item ( self , item) ;
1191
1191
self . parent_scope . module = orig_current_module;
1192
1192
if !macro_use {
1193
- self . parent_scope . legacy = orig_current_legacy_scope ;
1193
+ self . parent_scope . macro_rules = orig_current_macro_rules_scope ;
1194
1194
}
1195
1195
}
1196
1196
1197
1197
fn visit_stmt ( & mut self , stmt : & ' b ast:: Stmt ) {
1198
1198
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 ) ;
1200
1200
} else {
1201
1201
visit:: walk_stmt ( self , stmt) ;
1202
1202
}
@@ -1214,11 +1214,11 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
1214
1214
1215
1215
fn visit_block ( & mut self , block : & ' b Block ) {
1216
1216
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 ;
1218
1218
self . build_reduced_graph_for_block ( block) ;
1219
1219
visit:: walk_block ( self , block) ;
1220
1220
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 ;
1222
1222
}
1223
1223
1224
1224
fn visit_assoc_item ( & mut self , item : & ' b AssocItem , ctxt : AssocCtxt ) {
0 commit comments