@@ -861,7 +861,7 @@ impl SyntaxExtension {
861
861
/// | (unspecified) | no | if-ext | if-ext | yes |
862
862
/// | external | no | if-ext | if-ext | yes |
863
863
/// | 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 {
865
865
let flag = sess. opts . cg . collapse_macro_debuginfo ;
866
866
let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
867
867
. and_then ( |attr| {
@@ -872,7 +872,7 @@ impl SyntaxExtension {
872
872
. ok ( )
873
873
} )
874
874
. unwrap_or_else ( || {
875
- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
875
+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
876
876
CollapseMacroDebuginfo :: Yes
877
877
} else {
878
878
CollapseMacroDebuginfo :: Unspecified
@@ -915,16 +915,18 @@ impl SyntaxExtension {
915
915
let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
916
916
tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
917
917
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
+ } ;
928
930
929
931
let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
930
932
0 commit comments