@@ -418,11 +418,6 @@ pub struct ModuleData<'a> {
418418 normal_ancestor_id : DefId ,
419419
420420 resolutions : RefCell < FxHashMap < ( Ident , Namespace ) , & ' a RefCell < NameResolution < ' a > > > > ,
421- single_segment_macro_resolutions : RefCell < Vec < ( Ident , MacroKind , ParentScope < ' a > ,
422- Option < & ' a NameBinding < ' a > > ) > > ,
423- multi_segment_macro_resolutions : RefCell < Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' a > ,
424- Option < Res > ) > > ,
425- builtin_attrs : RefCell < Vec < ( Ident , ParentScope < ' a > ) > > ,
426421
427422 // Macro invocations that can expand into items in this module.
428423 unresolved_invocations : RefCell < FxHashSet < ExpnId > > ,
@@ -459,9 +454,6 @@ impl<'a> ModuleData<'a> {
459454 kind,
460455 normal_ancestor_id,
461456 resolutions : Default :: default ( ) ,
462- single_segment_macro_resolutions : RefCell :: new ( Vec :: new ( ) ) ,
463- multi_segment_macro_resolutions : RefCell :: new ( Vec :: new ( ) ) ,
464- builtin_attrs : RefCell :: new ( Vec :: new ( ) ) ,
465457 unresolved_invocations : Default :: default ( ) ,
466458 no_implicit_prelude : false ,
467459 glob_importers : RefCell :: new ( Vec :: new ( ) ) ,
@@ -896,6 +888,12 @@ pub struct Resolver<'a> {
896888 local_macro_def_scopes : FxHashMap < NodeId , Module < ' a > > ,
897889 unused_macros : NodeMap < Span > ,
898890 proc_macro_stubs : NodeSet ,
891+ /// Traces collected during macro resolution and validated when it's complete.
892+ single_segment_macro_resolutions : Vec < ( Ident , MacroKind , ParentScope < ' a > ,
893+ Option < & ' a NameBinding < ' a > > ) > ,
894+ multi_segment_macro_resolutions : Vec < ( Vec < Segment > , Span , MacroKind , ParentScope < ' a > ,
895+ Option < Res > ) > ,
896+ builtin_attrs : Vec < ( Ident , ParentScope < ' a > ) > ,
899897 /// Some built-in derives mark items they are applied to so they are treated specially later.
900898 /// Derive macros cannot modify the item themselves and have to store the markers in the global
901899 /// context, so they attach the markers to derive container IDs using this resolver table.
@@ -1151,6 +1149,9 @@ impl<'a> Resolver<'a> {
11511149 struct_constructors : Default :: default ( ) ,
11521150 unused_macros : Default :: default ( ) ,
11531151 proc_macro_stubs : Default :: default ( ) ,
1152+ single_segment_macro_resolutions : Default :: default ( ) ,
1153+ multi_segment_macro_resolutions : Default :: default ( ) ,
1154+ builtin_attrs : Default :: default ( ) ,
11541155 special_derives : Default :: default ( ) ,
11551156 active_features :
11561157 features. declared_lib_features . iter ( ) . map ( |( feat, ..) | * feat)
@@ -1203,6 +1204,7 @@ impl<'a> Resolver<'a> {
12031204 /// Entry point to crate resolution.
12041205 pub fn resolve_crate ( & mut self , krate : & Crate ) {
12051206 ImportResolver { r : self } . finalize_imports ( ) ;
1207+ self . finalize_macro_resolutions ( ) ;
12061208
12071209 self . late_resolve_crate ( krate) ;
12081210
0 commit comments