File tree Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Expand file tree Collapse file tree 3 files changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ impl<'a> Resolver<'a> {
145
145
}
146
146
}
147
147
148
- fn get_macro_by_def_id ( & mut self , def_id : DefId ) -> Option < Lrc < SyntaxExtension > > {
148
+ crate fn get_macro_by_def_id ( & mut self , def_id : DefId ) -> Option < Lrc < SyntaxExtension > > {
149
149
if let Some ( ext) = self . macro_map . get ( & def_id) {
150
150
return Some ( ext. clone ( ) ) ;
151
151
}
Original file line number Diff line number Diff line change @@ -1647,10 +1647,14 @@ impl<'a> Resolver<'a> {
1647
1647
if module. expansion != parent. expansion &&
1648
1648
module. expansion . is_descendant_of ( parent. expansion ) {
1649
1649
// The macro is a proc macro derive
1650
- if module. expansion . looks_like_proc_macro_derive ( ) {
1651
- if parent. expansion . outer_expn_is_descendant_of ( span. ctxt ( ) ) {
1652
- * poisoned = Some ( node_id) ;
1653
- return module. parent ;
1650
+ if let Some ( & def_id) = self . macro_defs . get ( & module. expansion ) {
1651
+ if let Some ( ext) = self . get_macro_by_def_id ( def_id) {
1652
+ if !ext. is_builtin && ext. macro_kind ( ) == MacroKind :: Derive {
1653
+ if parent. expansion . outer_expn_is_descendant_of ( span. ctxt ( ) ) {
1654
+ * poisoned = Some ( node_id) ;
1655
+ return module. parent ;
1656
+ }
1657
+ }
1654
1658
}
1655
1659
}
1656
1660
}
Original file line number Diff line number Diff line change @@ -119,18 +119,6 @@ impl ExpnId {
119
119
pub fn outer_expn_is_descendant_of ( self , ctxt : SyntaxContext ) -> bool {
120
120
HygieneData :: with ( |data| data. is_descendant_of ( self , data. outer_expn ( ctxt) ) )
121
121
}
122
-
123
- // Used for enabling some compatibility fallback in resolve.
124
- #[ inline]
125
- pub fn looks_like_proc_macro_derive ( self ) -> bool {
126
- HygieneData :: with ( |data| {
127
- let expn_data = data. expn_data ( self ) ;
128
- if let ExpnKind :: Macro ( MacroKind :: Derive , _) = expn_data. kind {
129
- return expn_data. default_transparency == Transparency :: Opaque ;
130
- }
131
- false
132
- } )
133
- }
134
122
}
135
123
136
124
#[ derive( Debug ) ]
You can’t perform that action at this time.
0 commit comments