@@ -681,33 +681,34 @@ impl MacResult for DummyResult {
681
681
}
682
682
683
683
/// A syntax extension kind.
684
+ #[ derive( Clone ) ]
684
685
pub enum SyntaxExtensionKind {
685
686
/// A token-based function-like macro.
686
687
Bang (
687
688
/// An expander with signature TokenStream -> TokenStream.
688
- Box < dyn BangProcMacro + sync:: DynSync + sync:: DynSend > ,
689
+ Arc < dyn BangProcMacro + sync:: DynSync + sync:: DynSend > ,
689
690
) ,
690
691
691
692
/// An AST-based function-like macro.
692
693
LegacyBang (
693
694
/// An expander with signature TokenStream -> AST.
694
- Box < dyn TTMacroExpander + sync:: DynSync + sync:: DynSend > ,
695
+ Arc < dyn TTMacroExpander + sync:: DynSync + sync:: DynSend > ,
695
696
) ,
696
697
697
698
/// A token-based attribute macro.
698
699
Attr (
699
700
/// An expander with signature (TokenStream, TokenStream) -> TokenStream.
700
701
/// The first TokenStream is the attribute itself, the second is the annotated item.
701
702
/// The produced TokenStream replaces the input TokenStream.
702
- Box < dyn AttrProcMacro + sync:: DynSync + sync:: DynSend > ,
703
+ Arc < dyn AttrProcMacro + sync:: DynSync + sync:: DynSend > ,
703
704
) ,
704
705
705
706
/// An AST-based attribute macro.
706
707
LegacyAttr (
707
708
/// An expander with signature (AST, AST) -> AST.
708
709
/// The first AST fragment is the attribute itself, the second is the annotated item.
709
710
/// The produced AST fragment replaces the input AST fragment.
710
- Box < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
711
+ Arc < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
711
712
) ,
712
713
713
714
/// A trivial attribute "macro" that does nothing,
@@ -724,18 +725,18 @@ pub enum SyntaxExtensionKind {
724
725
/// is handled identically to `LegacyDerive`. It should be migrated to
725
726
/// a token-based representation like `Bang` and `Attr`, instead of
726
727
/// using `MultiItemModifier`.
727
- Box < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
728
+ Arc < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
728
729
) ,
729
730
730
731
/// An AST-based derive macro.
731
732
LegacyDerive (
732
733
/// An expander with signature AST -> AST.
733
734
/// The produced AST fragment is appended to the input AST fragment.
734
- Box < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
735
+ Arc < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
735
736
) ,
736
737
737
738
/// A glob delegation.
738
- GlobDelegation ( Box < dyn GlobDelegationExpander + sync:: DynSync + sync:: DynSend > ) ,
739
+ GlobDelegation ( Arc < dyn GlobDelegationExpander + sync:: DynSync + sync:: DynSend > ) ,
739
740
}
740
741
741
742
/// A struct representing a macro definition in "lowered" form ready for expansion.
@@ -934,7 +935,7 @@ impl SyntaxExtension {
934
935
cx. dcx ( ) . span_delayed_bug ( span, "expanded a dummy bang macro" ) ,
935
936
) )
936
937
}
937
- SyntaxExtension :: default ( SyntaxExtensionKind :: LegacyBang ( Box :: new ( expander) ) , edition)
938
+ SyntaxExtension :: default ( SyntaxExtensionKind :: LegacyBang ( Arc :: new ( expander) ) , edition)
938
939
}
939
940
940
941
/// A dummy derive macro `#[derive(Foo)]`.
@@ -947,7 +948,7 @@ impl SyntaxExtension {
947
948
) -> Vec < Annotatable > {
948
949
Vec :: new ( )
949
950
}
950
- SyntaxExtension :: default ( SyntaxExtensionKind :: Derive ( Box :: new ( expander) ) , edition)
951
+ SyntaxExtension :: default ( SyntaxExtensionKind :: Derive ( Arc :: new ( expander) ) , edition)
951
952
}
952
953
953
954
pub fn non_macro_attr ( edition : Edition ) -> SyntaxExtension {
@@ -977,7 +978,7 @@ impl SyntaxExtension {
977
978
}
978
979
979
980
let expander = GlobDelegationExpanderImpl { trait_def_id, impl_def_id } ;
980
- SyntaxExtension :: default ( SyntaxExtensionKind :: GlobDelegation ( Box :: new ( expander) ) , edition)
981
+ SyntaxExtension :: default ( SyntaxExtensionKind :: GlobDelegation ( Arc :: new ( expander) ) , edition)
981
982
}
982
983
983
984
pub fn expn_data (
0 commit comments