@@ -922,7 +922,6 @@ pub struct Resolver<'a> {
922
922
dummy_ext_bang : Lrc < SyntaxExtension > ,
923
923
dummy_ext_derive : Lrc < SyntaxExtension > ,
924
924
non_macro_attrs : [ Lrc < SyntaxExtension > ; 2 ] ,
925
- macro_defs : FxHashMap < ExpnId , DefId > ,
926
925
local_macro_def_scopes : FxHashMap < NodeId , Module < ' a > > ,
927
926
ast_transform_scopes : FxHashMap < ExpnId , Module < ' a > > ,
928
927
unused_macros : NodeMap < Span > ,
@@ -1152,9 +1151,6 @@ impl<'a> Resolver<'a> {
1152
1151
let mut invocation_parent_scopes = FxHashMap :: default ( ) ;
1153
1152
invocation_parent_scopes. insert ( ExpnId :: root ( ) , ParentScope :: module ( graph_root) ) ;
1154
1153
1155
- let mut macro_defs = FxHashMap :: default ( ) ;
1156
- macro_defs. insert ( ExpnId :: root ( ) , root_def_id) ;
1157
-
1158
1154
let features = session. features_untracked ( ) ;
1159
1155
let non_macro_attr =
1160
1156
|mark_used| Lrc :: new ( SyntaxExtension :: non_macro_attr ( mark_used, session. edition ( ) ) ) ;
@@ -1229,7 +1225,6 @@ impl<'a> Resolver<'a> {
1229
1225
invocation_parent_scopes,
1230
1226
output_macro_rules_scopes : Default :: default ( ) ,
1231
1227
helper_attrs : Default :: default ( ) ,
1232
- macro_defs,
1233
1228
local_macro_def_scopes : FxHashMap :: default ( ) ,
1234
1229
name_already_seen : FxHashMap :: default ( ) ,
1235
1230
potentially_unused_imports : Vec :: new ( ) ,
@@ -1335,8 +1330,8 @@ impl<'a> Resolver<'a> {
1335
1330
1336
1331
fn macro_def ( & self , mut ctxt : SyntaxContext ) -> DefId {
1337
1332
loop {
1338
- match self . macro_defs . get ( & ctxt. outer_expn ( ) ) {
1339
- Some ( & def_id) => return def_id,
1333
+ match ctxt. outer_expn ( ) . expn_data ( ) . macro_def_id {
1334
+ Some ( def_id) => return def_id,
1340
1335
None => ctxt. remove_mark ( ) ,
1341
1336
} ;
1342
1337
}
@@ -1820,7 +1815,7 @@ impl<'a> Resolver<'a> {
1820
1815
&& module. expansion . is_descendant_of ( parent. expansion )
1821
1816
{
1822
1817
// The macro is a proc macro derive
1823
- if let Some ( & def_id) = self . macro_defs . get ( & module. expansion ) {
1818
+ if let Some ( def_id) = module. expansion . expn_data ( ) . macro_def_id {
1824
1819
if let Some ( ext) = self . get_macro_by_def_id ( def_id) {
1825
1820
if !ext. is_builtin && ext. macro_kind ( ) == MacroKind :: Derive {
1826
1821
if parent. expansion . outer_expn_is_descendant_of ( span. ctxt ( ) ) {
0 commit comments