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