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> {
145145 }
146146 }
147147
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 > > {
149149 if let Some ( ext) = self . macro_map . get ( & def_id) {
150150 return Some ( ext. clone ( ) ) ;
151151 }
Original file line number Diff line number Diff line change @@ -1647,10 +1647,14 @@ impl<'a> Resolver<'a> {
16471647 if module. expansion != parent. expansion &&
16481648 module. expansion . is_descendant_of ( parent. expansion ) {
16491649 // 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+ }
16541658 }
16551659 }
16561660 }
Original file line number Diff line number Diff line change @@ -119,18 +119,6 @@ impl ExpnId {
119119 pub fn outer_expn_is_descendant_of ( self , ctxt : SyntaxContext ) -> bool {
120120 HygieneData :: with ( |data| data. is_descendant_of ( self , data. outer_expn ( ctxt) ) )
121121 }
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- }
134122}
135123
136124#[ derive( Debug ) ]
You can’t perform that action at this time.
0 commit comments