@@ -864,7 +864,7 @@ impl SyntaxExtension {
864
864
/// | (unspecified) | no | if-ext | if-ext | yes |
865
865
/// | external | no | if-ext | if-ext | yes |
866
866
/// | 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 {
868
868
let flag = sess. opts . cg . collapse_macro_debuginfo ;
869
869
let attr = ast:: attr:: find_by_name ( attrs, sym:: collapse_debuginfo)
870
870
. and_then ( |attr| {
@@ -875,7 +875,7 @@ impl SyntaxExtension {
875
875
. ok ( )
876
876
} )
877
877
. unwrap_or_else ( || {
878
- if ast :: attr :: contains_name ( attrs, sym :: rustc_builtin_macro ) {
878
+ if find_attr ! ( attrs, AttributeKind :: RustcBuiltinMacro { .. } ) {
879
879
CollapseMacroDebuginfo :: Yes
880
880
} else {
881
881
CollapseMacroDebuginfo :: Unspecified
@@ -918,16 +918,18 @@ impl SyntaxExtension {
918
918
let collapse_debuginfo = Self :: get_collapse_debuginfo ( sess, attrs, !is_local) ;
919
919
tracing:: debug!( ?name, ?local_inner_macros, ?collapse_debuginfo, ?allow_internal_unsafe) ;
920
920
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
+ } ;
931
933
932
934
let stability = find_attr ! ( attrs, AttributeKind :: Stability { stability, .. } => * stability) ;
933
935
0 commit comments