@@ -844,7 +844,7 @@ impl SyntaxExtension {
844
844
/// | (unspecified) | no | if-ext | if-ext | yes |
845
845
/// | external | no | if-ext | if-ext | yes |
846
846
/// | 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 {
848
848
let flag = sess. opts . cg . collapse_macro_debuginfo ;
849
849
let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
850
850
. and_then ( |attr| {
@@ -855,7 +855,7 @@ impl SyntaxExtension {
855
855
. ok ( )
856
856
} )
857
857
. unwrap_or_else ( || {
858
- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
858
+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
859
859
CollapseMacroDebuginfo :: Yes
860
860
} else {
861
861
CollapseMacroDebuginfo :: Unspecified
@@ -898,16 +898,18 @@ impl SyntaxExtension {
898
898
let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
899
899
tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
900
900
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
+ } ;
911
913
912
914
let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
913
915
0 commit comments