@@ -864,7 +864,7 @@ impl SyntaxExtension {
864864 /// | (unspecified) | no | if-ext | if-ext | yes |
865865 /// | external | no | if-ext | if-ext | yes |
866866 /// | yes | yes | yes | yes | yes |
867- fn get_collapse_debuginfo ( sess : & Session , attrs : & [ impl AttributeExt ] , ext : bool ) -> bool {
867+ fn get_collapse_debuginfo ( sess : & Session , attrs : & [ hir :: Attribute ] , ext : bool ) -> bool {
868868 let flag = sess. opts . cg . collapse_macro_debuginfo ;
869869 let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
870870 . and_then ( |attr| {
@@ -875,7 +875,7 @@ impl SyntaxExtension {
875875 . ok ( )
876876 } )
877877 . unwrap_or_else ( || {
878- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
878+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
879879 CollapseMacroDebuginfo :: Yes
880880 } else {
881881 CollapseMacroDebuginfo :: Unspecified
@@ -918,16 +918,18 @@ impl SyntaxExtension {
918918 let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
919919 tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
920920
921- let ( builtin_name, helper_attrs) = ast:: attr:: find_by_name ( attrs, sym:: rustc_builtin_macro)
922- . map ( |attr| {
923- // Override `helper_attrs` passed above if it's a built-in macro,
924- // marking `proc_macro_derive` macros as built-in is not a realistic use case.
925- parse_macro_name_and_helper_attrs ( sess. dcx ( ) , attr, "built-in" ) . map_or_else (
926- || ( Some ( name) , Vec :: new ( ) ) ,
927- |( name, helper_attrs) | ( Some ( name) , helper_attrs) ,
928- )
929- } )
930- . unwrap_or_else ( || ( None , helper_attrs) ) ;
921+ let ( builtin_name, helper_attrs) = match find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { builtin_name, helper_attrs, .. } => ( builtin_name, helper_attrs) )
922+ {
923+ // Override `helper_attrs` passed above if it's a built-in macro,
924+ // marking `proc_macro_derive` macros as built-in is not a realistic use case.
925+ Some ( ( Some ( name) , helper_attrs) ) => {
926+ ( Some ( * name) , helper_attrs. iter ( ) . copied ( ) . collect ( ) )
927+ }
928+ Some ( ( None , _) ) => ( Some ( name) , Vec :: new ( ) ) ,
929+
930+ // Not a built-in macro
931+ None => ( None , helper_attrs) ,
932+ } ;
931933
932934 let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
933935
0 commit comments