@@ -844,7 +844,7 @@ impl SyntaxExtension {
844844 /// | (unspecified) | no | if-ext | if-ext | yes |
845845 /// | external | no | if-ext | if-ext | yes |
846846 /// | yes | yes | yes | yes | yes |
847- fn get_collapse_debuginfo ( sess : & Session , attrs : & [ impl AttributeExt ] , ext : bool ) -> bool {
847+ fn get_collapse_debuginfo ( sess : & Session , attrs : & [ hir :: Attribute ] , ext : bool ) -> bool {
848848 let flag = sess. opts . cg . collapse_macro_debuginfo ;
849849 let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
850850 . and_then ( |attr| {
@@ -855,7 +855,7 @@ impl SyntaxExtension {
855855 . ok ( )
856856 } )
857857 . unwrap_or_else ( || {
858- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
858+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
859859 CollapseMacroDebuginfo :: Yes
860860 } else {
861861 CollapseMacroDebuginfo :: Unspecified
@@ -898,16 +898,18 @@ impl SyntaxExtension {
898898 let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
899899 tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
900900
901- let ( builtin_name, helper_attrs) = ast:: attr:: find_by_name ( attrs, sym:: rustc_builtin_macro)
902- . map ( |attr| {
903- // Override `helper_attrs` passed above if it's a built-in macro,
904- // marking `proc_macro_derive` macros as built-in is not a realistic use case.
905- parse_macro_name_and_helper_attrs ( sess. dcx ( ) , attr, "built-in" ) . map_or_else (
906- || ( Some ( name) , Vec :: new ( ) ) ,
907- |( name, helper_attrs) | ( Some ( name) , helper_attrs) ,
908- )
909- } )
910- . unwrap_or_else ( || ( None , helper_attrs) ) ;
901+ let ( builtin_name, helper_attrs) = match find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { builtin_name, helper_attrs, .. } => ( builtin_name, helper_attrs) )
902+ {
903+ // Override `helper_attrs` passed above if it's a built-in macro,
904+ // marking `proc_macro_derive` macros as built-in is not a realistic use case.
905+ Some ( ( Some ( name) , helper_attrs) ) => {
906+ ( Some ( * name) , helper_attrs. iter ( ) . copied ( ) . collect ( ) )
907+ }
908+ Some ( ( None , _) ) => ( Some ( name) , Vec :: new ( ) ) ,
909+
910+ // Not a built-in macro
911+ None => ( None , helper_attrs) ,
912+ } ;
911913
912914 let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
913915
0 commit comments