@@ -681,33 +681,34 @@ impl MacResult for DummyResult {
681681}
682682
683683/// A syntax extension kind.
684+ #[ derive( Clone ) ]
684685pub enum SyntaxExtensionKind {
685686 /// A token-based function-like macro.
686687 Bang (
687688 /// An expander with signature TokenStream -> TokenStream.
688- Box < dyn BangProcMacro + sync:: DynSync + sync:: DynSend > ,
689+ Arc < dyn BangProcMacro + sync:: DynSync + sync:: DynSend > ,
689690 ) ,
690691
691692 /// An AST-based function-like macro.
692693 LegacyBang (
693694 /// An expander with signature TokenStream -> AST.
694- Box < dyn TTMacroExpander + sync:: DynSync + sync:: DynSend > ,
695+ Arc < dyn TTMacroExpander + sync:: DynSync + sync:: DynSend > ,
695696 ) ,
696697
697698 /// A token-based attribute macro.
698699 Attr (
699700 /// An expander with signature (TokenStream, TokenStream) -> TokenStream.
700701 /// The first TokenStream is the attribute itself, the second is the annotated item.
701702 /// The produced TokenStream replaces the input TokenStream.
702- Box < dyn AttrProcMacro + sync:: DynSync + sync:: DynSend > ,
703+ Arc < dyn AttrProcMacro + sync:: DynSync + sync:: DynSend > ,
703704 ) ,
704705
705706 /// An AST-based attribute macro.
706707 LegacyAttr (
707708 /// An expander with signature (AST, AST) -> AST.
708709 /// The first AST fragment is the attribute itself, the second is the annotated item.
709710 /// 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 > ,
711712 ) ,
712713
713714 /// A trivial attribute "macro" that does nothing,
@@ -724,18 +725,18 @@ pub enum SyntaxExtensionKind {
724725 /// is handled identically to `LegacyDerive`. It should be migrated to
725726 /// a token-based representation like `Bang` and `Attr`, instead of
726727 /// using `MultiItemModifier`.
727- Box < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
728+ Arc < dyn MultiItemModifier + sync:: DynSync + sync:: DynSend > ,
728729 ) ,
729730
730731 /// An AST-based derive macro.
731732 LegacyDerive (
732733 /// An expander with signature AST -> AST.
733734 /// 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 > ,
735736 ) ,
736737
737738 /// A glob delegation.
738- GlobDelegation ( Box < dyn GlobDelegationExpander + sync:: DynSync + sync:: DynSend > ) ,
739+ GlobDelegation ( Arc < dyn GlobDelegationExpander + sync:: DynSync + sync:: DynSend > ) ,
739740}
740741
741742/// A struct representing a macro definition in "lowered" form ready for expansion.
@@ -937,7 +938,7 @@ impl SyntaxExtension {
937938 cx. dcx ( ) . span_delayed_bug ( span, "expanded a dummy bang macro" ) ,
938939 ) )
939940 }
940- SyntaxExtension :: default ( SyntaxExtensionKind :: LegacyBang ( Box :: new ( expander) ) , edition)
941+ SyntaxExtension :: default ( SyntaxExtensionKind :: LegacyBang ( Arc :: new ( expander) ) , edition)
941942 }
942943
943944 /// A dummy derive macro `#[derive(Foo)]`.
@@ -950,7 +951,7 @@ impl SyntaxExtension {
950951 ) -> Vec < Annotatable > {
951952 Vec :: new ( )
952953 }
953- SyntaxExtension :: default ( SyntaxExtensionKind :: Derive ( Box :: new ( expander) ) , edition)
954+ SyntaxExtension :: default ( SyntaxExtensionKind :: Derive ( Arc :: new ( expander) ) , edition)
954955 }
955956
956957 pub fn non_macro_attr ( edition : Edition ) -> SyntaxExtension {
@@ -980,7 +981,7 @@ impl SyntaxExtension {
980981 }
981982
982983 let expander = GlobDelegationExpanderImpl { trait_def_id, impl_def_id } ;
983- SyntaxExtension :: default ( SyntaxExtensionKind :: GlobDelegation ( Box :: new ( expander) ) , edition)
984+ SyntaxExtension :: default ( SyntaxExtensionKind :: GlobDelegation ( Arc :: new ( expander) ) , edition)
984985 }
985986
986987 pub fn expn_data (
0 commit comments