@@ -861,7 +861,7 @@ impl SyntaxExtension {
861861 /// | (unspecified) | no | if-ext | if-ext | yes |
862862 /// | external | no | if-ext | if-ext | yes |
863863 /// | yes | yes | yes | yes | yes |
864- fn get_collapse_debuginfo ( sess : & Session , attrs : & [ impl AttributeExt ] , ext : bool ) -> bool {
864+ fn get_collapse_debuginfo ( sess : & Session , attrs : & [ hir :: Attribute ] , ext : bool ) -> bool {
865865 let flag = sess. opts . cg . collapse_macro_debuginfo ;
866866 let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
867867 . and_then ( |attr| {
@@ -872,7 +872,7 @@ impl SyntaxExtension {
872872 . ok ( )
873873 } )
874874 . unwrap_or_else ( || {
875- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
875+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
876876 CollapseMacroDebuginfo :: Yes
877877 } else {
878878 CollapseMacroDebuginfo :: Unspecified
@@ -915,16 +915,18 @@ impl SyntaxExtension {
915915 let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
916916 tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
917917
918- let ( builtin_name, helper_attrs) = ast:: attr:: find_by_name ( attrs, sym:: rustc_builtin_macro)
919- . map ( |attr| {
920- // Override `helper_attrs` passed above if it's a built-in macro,
921- // marking `proc_macro_derive` macros as built-in is not a realistic use case.
922- parse_macro_name_and_helper_attrs ( sess. dcx ( ) , attr, "built-in" ) . map_or_else (
923- || ( Some ( name) , Vec :: new ( ) ) ,
924- |( name, helper_attrs) | ( Some ( name) , helper_attrs) ,
925- )
926- } )
927- . unwrap_or_else ( || ( None , helper_attrs) ) ;
918+ let ( builtin_name, helper_attrs) = match find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { builtin_name, helper_attrs, .. } => ( builtin_name, helper_attrs) )
919+ {
920+ // Override `helper_attrs` passed above if it's a built-in macro,
921+ // marking `proc_macro_derive` macros as built-in is not a realistic use case.
922+ Some ( ( Some ( name) , helper_attrs) ) => {
923+ ( Some ( * name) , helper_attrs. iter ( ) . copied ( ) . collect ( ) )
924+ }
925+ Some ( ( None , _) ) => ( Some ( name) , Vec :: new ( ) ) ,
926+
927+ // Not a built-in macro
928+ None => ( None , helper_attrs) ,
929+ } ;
928930
929931 let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
930932
0 commit comments