@@ -490,7 +490,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
490
490
self . cx . force_mode = force;
491
491
492
492
let fragment_kind = invoc. fragment_kind ;
493
- match self . expand_invoc ( invoc, & ext) {
493
+ match self . expand_invoc ( invoc, & ext. kind ) {
494
494
ExpandResult :: Ready ( fragment) => {
495
495
let mut derive_invocations = Vec :: new ( ) ;
496
496
let derive_placeholders = self
@@ -652,7 +652,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
652
652
fn expand_invoc (
653
653
& mut self ,
654
654
invoc : Invocation ,
655
- ext : & Lrc < SyntaxExtension > ,
655
+ ext : & SyntaxExtensionKind ,
656
656
) -> ExpandResult < AstFragment , Invocation > {
657
657
let recursion_limit = match self . cx . reduced_recursion_limit {
658
658
Some ( ( limit, _) ) => limit,
@@ -673,7 +673,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
673
673
674
674
let ( fragment_kind, span) = ( invoc. fragment_kind , invoc. span ( ) ) ;
675
675
ExpandResult :: Ready ( match invoc. kind {
676
- InvocationKind :: Bang { mac, span } => match & ext. kind {
676
+ InvocationKind :: Bang { mac, span } => match ext {
677
677
SyntaxExtensionKind :: Bang ( expander) => {
678
678
match expander. expand ( self . cx , span, mac. args . tokens . clone ( ) ) {
679
679
Ok ( tok_result) => {
@@ -703,7 +703,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
703
703
}
704
704
_ => unreachable ! ( ) ,
705
705
} ,
706
- InvocationKind :: Attr { attr, pos, mut item, derives } => match & ext. kind {
706
+ InvocationKind :: Attr { attr, pos, mut item, derives } => match ext {
707
707
SyntaxExtensionKind :: Attr ( expander) => {
708
708
self . gate_proc_macro_input ( & item) ;
709
709
self . gate_proc_macro_attr_item ( span, & item) ;
@@ -782,10 +782,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
782
782
}
783
783
_ => unreachable ! ( ) ,
784
784
} ,
785
- InvocationKind :: Derive { path, item, is_const } => match & ext. kind {
785
+ InvocationKind :: Derive { path, item, is_const } => match ext {
786
786
SyntaxExtensionKind :: Derive ( expander)
787
787
| SyntaxExtensionKind :: LegacyDerive ( expander) => {
788
- if let SyntaxExtensionKind :: Derive ( ..) = ext. kind {
788
+ if let SyntaxExtensionKind :: Derive ( ..) = ext {
789
789
self . gate_proc_macro_input ( & item) ;
790
790
}
791
791
// The `MetaItem` representing the trait to derive can't
@@ -796,7 +796,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
796
796
span,
797
797
path,
798
798
} ;
799
- invoc. expansion_data . id . expn_data ( ) ;
800
799
let items = match expander. expand ( self . cx , span, & meta, item, is_const) {
801
800
ExpandResult :: Ready ( items) => items,
802
801
ExpandResult :: Retry ( item) => {
@@ -813,19 +812,18 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
813
812
} ,
814
813
InvocationKind :: GlobDelegation { item } => {
815
814
let AssocItemKind :: DelegationMac ( deleg) = & item. kind else { unreachable ! ( ) } ;
816
- let suffixes = match & ext. kind {
817
- SyntaxExtensionKind :: GlobDelegation ( expander) => {
818
- match expander. expand ( self . cx ) {
819
- ExpandResult :: Ready ( suffixes) => suffixes,
820
- ExpandResult :: Retry ( ( ) ) => {
821
- // Reassemble the original invocation for retrying.
822
- return ExpandResult :: Retry ( Invocation {
823
- kind : InvocationKind :: GlobDelegation { item } ,
824
- ..invoc
825
- } ) ;
826
- }
815
+ let suffixes = match ext {
816
+ SyntaxExtensionKind :: GlobDelegation ( expander) => match expander. expand ( self . cx )
817
+ {
818
+ ExpandResult :: Ready ( suffixes) => suffixes,
819
+ ExpandResult :: Retry ( ( ) ) => {
820
+ // Reassemble the original invocation for retrying.
821
+ return ExpandResult :: Retry ( Invocation {
822
+ kind : InvocationKind :: GlobDelegation { item } ,
823
+ ..invoc
824
+ } ) ;
827
825
}
828
- }
826
+ } ,
829
827
SyntaxExtensionKind :: LegacyBang ( ..) => {
830
828
let msg = "expanded a dummy glob delegation" ;
831
829
let guar = self . cx . dcx ( ) . span_delayed_bug ( span, msg) ;
0 commit comments