@@ -252,7 +252,7 @@ pub fn expand_speculative(
252252 // Otherwise the expand query will fetch the non speculative attribute args and pass those instead.
253253 let mut speculative_expansion =
254254 match loc. def . kind {
255- MacroDefKind :: ProcMacro ( expander , _ , ast ) => {
255+ MacroDefKind :: ProcMacro ( ast , expander , _ ) => {
256256 let span = db. proc_macro_span ( ast) ;
257257 tt. delimiter = tt:: Delimiter :: invisible_spanned ( span) ;
258258 expander. expand (
@@ -266,22 +266,22 @@ pub fn expand_speculative(
266266 span_with_mixed_site_ctxt ( db, span, actual_macro_call) ,
267267 )
268268 }
269- MacroDefKind :: BuiltInAttr ( BuiltinAttrExpander :: Derive , _ ) => {
269+ MacroDefKind :: BuiltInAttr ( _ , it ) if it . is_derive ( ) => {
270270 pseudo_derive_attr_expansion ( & tt, attr_arg. as_ref ( ) ?, span)
271271 }
272272 MacroDefKind :: Declarative ( it) => db
273273 . decl_macro_expander ( loc. krate , it)
274274 . expand_unhygienic ( db, tt, loc. def . krate , span, loc. def . edition ) ,
275- MacroDefKind :: BuiltIn ( it , _ ) => {
275+ MacroDefKind :: BuiltIn ( _ , it ) => {
276276 it. expand ( db, actual_macro_call, & tt, span) . map_err ( Into :: into)
277277 }
278- MacroDefKind :: BuiltInDerive ( it , .. ) => {
278+ MacroDefKind :: BuiltInDerive ( _ , it ) => {
279279 it. expand ( db, actual_macro_call, & tt, span) . map_err ( Into :: into)
280280 }
281- MacroDefKind :: BuiltInEager ( it , _ ) => {
281+ MacroDefKind :: BuiltInEager ( _ , it ) => {
282282 it. expand ( db, actual_macro_call, & tt, span) . map_err ( Into :: into)
283283 }
284- MacroDefKind :: BuiltInAttr ( it , _ ) => it. expand ( db, actual_macro_call, & tt, span) ,
284+ MacroDefKind :: BuiltInAttr ( _ , it ) => it. expand ( db, actual_macro_call, & tt, span) ,
285285 } ;
286286
287287 let expand_to = loc. expand_to ( ) ;
@@ -493,7 +493,7 @@ fn macro_arg(db: &dyn ExpandDatabase, id: MacroCallId) -> MacroArgResult {
493493 . map_or_else ( || node. syntax ( ) . text_range ( ) , |it| it. syntax ( ) . text_range ( ) ) ,
494494 ) ;
495495 // If derive attribute we need to censor the derive input
496- if matches ! ( loc. def. kind, MacroDefKind :: BuiltInAttr ( expander , .. ) if expander. is_derive( ) )
496+ if matches ! ( loc. def. kind, MacroDefKind :: BuiltInAttr ( _ , expander ) if expander. is_derive( ) )
497497 && ast:: Adt :: can_cast ( node. syntax ( ) . kind ( ) )
498498 {
499499 let adt = ast:: Adt :: cast ( node. syntax ( ) . clone ( ) ) . unwrap ( ) ;
@@ -569,11 +569,11 @@ impl TokenExpander {
569569 MacroDefKind :: Declarative ( ast_id) => {
570570 TokenExpander :: DeclarativeMacro ( db. decl_macro_expander ( id. krate , ast_id) )
571571 }
572- MacroDefKind :: BuiltIn ( expander , _ ) => TokenExpander :: BuiltIn ( expander) ,
573- MacroDefKind :: BuiltInAttr ( expander , _ ) => TokenExpander :: BuiltInAttr ( expander) ,
574- MacroDefKind :: BuiltInDerive ( expander , _ ) => TokenExpander :: BuiltInDerive ( expander) ,
575- MacroDefKind :: BuiltInEager ( expander , .. ) => TokenExpander :: BuiltInEager ( expander) ,
576- MacroDefKind :: ProcMacro ( expander, .. ) => TokenExpander :: ProcMacro ( expander) ,
572+ MacroDefKind :: BuiltIn ( _ , expander ) => TokenExpander :: BuiltIn ( expander) ,
573+ MacroDefKind :: BuiltInAttr ( _ , expander ) => TokenExpander :: BuiltInAttr ( expander) ,
574+ MacroDefKind :: BuiltInDerive ( _ , expander ) => TokenExpander :: BuiltInDerive ( expander) ,
575+ MacroDefKind :: BuiltInEager ( _ , expander ) => TokenExpander :: BuiltInEager ( expander) ,
576+ MacroDefKind :: ProcMacro ( _ , expander, _ ) => TokenExpander :: ProcMacro ( expander) ,
577577 }
578578 }
579579}
@@ -604,13 +604,13 @@ fn macro_expand(
604604 MacroDefKind :: Declarative ( id) => db
605605 . decl_macro_expander ( loc. def . krate , id)
606606 . expand ( db, arg. clone ( ) , macro_call_id, span) ,
607- MacroDefKind :: BuiltIn ( it , _ ) => {
607+ MacroDefKind :: BuiltIn ( _ , it ) => {
608608 it. expand ( db, macro_call_id, arg, span) . map_err ( Into :: into) . zip_val ( None )
609609 }
610- MacroDefKind :: BuiltInDerive ( it , _ ) => {
610+ MacroDefKind :: BuiltInDerive ( _ , it ) => {
611611 it. expand ( db, macro_call_id, arg, span) . map_err ( Into :: into) . zip_val ( None )
612612 }
613- MacroDefKind :: BuiltInEager ( it , _ ) => {
613+ MacroDefKind :: BuiltInEager ( _ , it ) => {
614614 // This might look a bit odd, but we do not expand the inputs to eager macros here.
615615 // Eager macros inputs are expanded, well, eagerly when we collect the macro calls.
616616 // That kind of expansion uses the ast id map of an eager macros input though which goes through
@@ -634,12 +634,12 @@ fn macro_expand(
634634 }
635635 res. zip_val ( None )
636636 }
637- MacroDefKind :: BuiltInAttr ( it , _ ) => {
637+ MacroDefKind :: BuiltInAttr ( _ , it ) => {
638638 let mut res = it. expand ( db, macro_call_id, arg, span) ;
639639 fixup:: reverse_fixups ( & mut res. value , & undo_info) ;
640640 res. zip_val ( None )
641641 }
642- _ => unreachable ! ( ) ,
642+ MacroDefKind :: ProcMacro ( _ , _ , _ ) => unreachable ! ( ) ,
643643 } ;
644644 ( ExpandResult { value : res. value , err : res. err } , span)
645645 }
@@ -678,8 +678,8 @@ fn expand_proc_macro(db: &dyn ExpandDatabase, id: MacroCallId) -> ExpandResult<A
678678 let loc = db. lookup_intern_macro_call ( id) ;
679679 let ( macro_arg, undo_info, span) = db. macro_arg_considering_derives ( id, & loc. kind ) ;
680680
681- let ( expander , ast ) = match loc. def . kind {
682- MacroDefKind :: ProcMacro ( expander , _ , ast ) => ( expander , ast ) ,
681+ let ( ast , expander ) = match loc. def . kind {
682+ MacroDefKind :: ProcMacro ( ast , expander , _ ) => ( ast , expander ) ,
683683 _ => unreachable ! ( ) ,
684684 } ;
685685
0 commit comments