@@ -621,7 +621,10 @@ pub(crate) fn load_proc_macro(
621
621
} ;
622
622
let expander: Arc < dyn ProcMacroExpander > =
623
623
if dummy_replace. iter ( ) . any ( |replace| & * * replace == name) {
624
- Arc :: new ( DummyExpander )
624
+ match kind {
625
+ ProcMacroKind :: Attr => Arc :: new ( IdentityExpander ) ,
626
+ _ => Arc :: new ( EmptyExpander ) ,
627
+ }
625
628
} else {
626
629
Arc :: new ( Expander ( expander) )
627
630
} ;
@@ -647,11 +650,11 @@ pub(crate) fn load_proc_macro(
647
650
}
648
651
}
649
652
650
- /// Dummy identity expander, used for proc-macros that are deliberately ignored by the user.
653
+ /// Dummy identity expander, used for attribute proc-macros that are deliberately ignored by the user.
651
654
#[ derive( Debug ) ]
652
- struct DummyExpander ;
655
+ struct IdentityExpander ;
653
656
654
- impl ProcMacroExpander for DummyExpander {
657
+ impl ProcMacroExpander for IdentityExpander {
655
658
fn expand (
656
659
& self ,
657
660
subtree : & tt:: Subtree ,
@@ -661,6 +664,21 @@ pub(crate) fn load_proc_macro(
661
664
Ok ( subtree. clone ( ) )
662
665
}
663
666
}
667
+
668
+ /// Empty expander, used for proc-macros that are deliberately ignored by the user.
669
+ #[ derive( Debug ) ]
670
+ struct EmptyExpander ;
671
+
672
+ impl ProcMacroExpander for EmptyExpander {
673
+ fn expand (
674
+ & self ,
675
+ _: & tt:: Subtree ,
676
+ _: Option < & tt:: Subtree > ,
677
+ _: & Env ,
678
+ ) -> Result < tt:: Subtree , ProcMacroExpansionError > {
679
+ Ok ( tt:: Subtree :: default ( ) )
680
+ }
681
+ }
664
682
}
665
683
666
684
pub ( crate ) fn should_refresh_for_change ( path : & AbsPath , change_kind : ChangeKind ) -> bool {
0 commit comments