Auto merge of #138613 - m-ou-se:no-more-e0773, r= · rust-lang/rust@cfeb465 (original) (raw)

`@@ -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.

`

`@@ -937,7 +938,7 @@ impl SyntaxExtension {

`

937

938

` cx.dcx().span_delayed_bug(span, "expanded a dummy bang macro"),

`

938

939

`))

`

939

940

`}

`

940

``

`-

SyntaxExtension::default(SyntaxExtensionKind::LegacyBang(Box::new(expander)), edition)

`

``

941

`+

SyntaxExtension::default(SyntaxExtensionKind::LegacyBang(Arc::new(expander)), edition)

`

941

942

`}

`

942

943

``

943

944

`` /// A dummy derive macro #[derive(Foo)].

``

`@@ -950,7 +951,7 @@ impl SyntaxExtension {

`

950

951

`) -> Vec {

`

951

952

`Vec::new()

`

952

953

`}

`

953

``

`-

SyntaxExtension::default(SyntaxExtensionKind::Derive(Box::new(expander)), edition)

`

``

954

`+

SyntaxExtension::default(SyntaxExtensionKind::Derive(Arc::new(expander)), edition)

`

954

955

`}

`

955

956

``

956

957

`pub fn non_macro_attr(edition: Edition) -> SyntaxExtension {

`

`@@ -980,7 +981,7 @@ impl SyntaxExtension {

`

980

981

`}

`

981

982

``

982

983

`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)

`

984

985

`}

`

985

986

``

986

987

`pub fn expn_data(

`