@@ -512,7 +512,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
512
512
self . cx . force_mode = force;
513
513
514
514
let fragment_kind = invoc. fragment_kind ;
515
- match self . expand_invoc ( invoc, & ext. kind ) {
515
+ match self . expand_invoc ( invoc, & ext) {
516
516
ExpandResult :: Ready ( fragment) => {
517
517
let mut derive_invocations = Vec :: new ( ) ;
518
518
let derive_placeholders = self
@@ -674,7 +674,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
674
674
fn expand_invoc (
675
675
& mut self ,
676
676
invoc : Invocation ,
677
- ext : & SyntaxExtensionKind ,
677
+ ext : & Lrc < SyntaxExtension > ,
678
678
) -> ExpandResult < AstFragment , Invocation > {
679
679
let recursion_limit = match self . cx . reduced_recursion_limit {
680
680
Some ( ( limit, _) ) => limit,
@@ -695,7 +695,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
695
695
696
696
let ( fragment_kind, span) = ( invoc. fragment_kind , invoc. span ( ) ) ;
697
697
ExpandResult :: Ready ( match invoc. kind {
698
- InvocationKind :: Bang { mac, span } => match ext {
698
+ InvocationKind :: Bang { mac, span } => match & ext. kind {
699
699
SyntaxExtensionKind :: Bang ( expander) => {
700
700
match expander. expand ( self . cx , span, mac. args . tokens . clone ( ) ) {
701
701
Ok ( tok_result) => {
@@ -725,7 +725,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
725
725
}
726
726
_ => unreachable ! ( ) ,
727
727
} ,
728
- InvocationKind :: Attr { attr, pos, mut item, derives } => match ext {
728
+ InvocationKind :: Attr { attr, pos, mut item, derives } => match & ext. kind {
729
729
SyntaxExtensionKind :: Attr ( expander) => {
730
730
self . gate_proc_macro_input ( & item) ;
731
731
self . gate_proc_macro_attr_item ( span, & item) ;
@@ -804,10 +804,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
804
804
}
805
805
_ => unreachable ! ( ) ,
806
806
} ,
807
- InvocationKind :: Derive { path, item, is_const } => match ext {
807
+ InvocationKind :: Derive { path, item, is_const } => match & ext. kind {
808
808
SyntaxExtensionKind :: Derive ( expander)
809
809
| SyntaxExtensionKind :: LegacyDerive ( expander) => {
810
- if let SyntaxExtensionKind :: Derive ( ..) = ext {
810
+ if let SyntaxExtensionKind :: Derive ( ..) = ext. kind {
811
811
self . gate_proc_macro_input ( & item) ;
812
812
}
813
813
// The `MetaItem` representing the trait to derive can't
@@ -834,18 +834,19 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
834
834
} ,
835
835
InvocationKind :: GlobDelegation { item, of_trait } => {
836
836
let AssocItemKind :: DelegationMac ( deleg) = & item. kind else { unreachable ! ( ) } ;
837
- let suffixes = match ext {
838
- SyntaxExtensionKind :: GlobDelegation ( expander) => match expander. expand ( self . cx )
839
- {
840
- ExpandResult :: Ready ( suffixes) => suffixes,
841
- ExpandResult :: Retry ( ( ) ) => {
842
- // Reassemble the original invocation for retrying.
843
- return ExpandResult :: Retry ( Invocation {
844
- kind : InvocationKind :: GlobDelegation { item, of_trait } ,
845
- ..invoc
846
- } ) ;
837
+ let suffixes = match & ext. kind {
838
+ SyntaxExtensionKind :: GlobDelegation ( expander) => {
839
+ match expander. expand ( self . cx ) {
840
+ ExpandResult :: Ready ( suffixes) => suffixes,
841
+ ExpandResult :: Retry ( ( ) ) => {
842
+ // Reassemble the original invocation for retrying.
843
+ return ExpandResult :: Retry ( Invocation {
844
+ kind : InvocationKind :: GlobDelegation { item, of_trait } ,
845
+ ..invoc
846
+ } ) ;
847
+ }
847
848
}
848
- } ,
849
+ }
849
850
SyntaxExtensionKind :: LegacyBang ( ..) => {
850
851
let msg = "expanded a dummy glob delegation" ;
851
852
let guar = self . cx . dcx ( ) . span_delayed_bug ( span, msg) ;
0 commit comments