@@ -700,16 +700,24 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
700700 rustc_attr ! ( rustc_lint_diagnostics, Normal , template!( Word ) , WarnFollowing , INTERNAL_UNSTABLE ) ,
701701 // Used by the `rustc::bad_opt_access` lint to identify `DebuggingOptions` and `CodegenOptions`
702702 // types (as well as any others in future).
703- rustc_attr ! ( rustc_lint_opt_ty, Normal , template!( Word ) , WarnFollowing , INTERNAL_UNSTABLE ) ,
703+ rustc_attr ! (
704+ rustc_lint_opt_ty, Normal , template!( Word ) ,
705+ WarnFollowing , @only_local: true , INTERNAL_UNSTABLE
706+ ) ,
704707 // Used by the `rustc::bad_opt_access` lint on fields
705708 // types (as well as any others in future).
706- rustc_attr ! ( rustc_lint_opt_deny_field_access, Normal , template!( List : "message" ) , WarnFollowing , INTERNAL_UNSTABLE ) ,
709+ rustc_attr ! (
710+ rustc_lint_opt_deny_field_access, Normal , template!( List : "message" ) ,
711+ WarnFollowing , @only_local: true , INTERNAL_UNSTABLE
712+ ) ,
707713
708714 // ==========================================================================
709715 // Internal attributes, Const related:
710716 // ==========================================================================
711717
712- rustc_attr ! ( rustc_promotable, Normal , template!( Word ) , WarnFollowing , IMPL_DETAIL ) ,
718+ rustc_attr ! (
719+ rustc_promotable, Normal , template!( Word ) , WarnFollowing ,
720+ @only_local: true , IMPL_DETAIL ) ,
713721 rustc_attr ! (
714722 rustc_legacy_const_generics, Normal , template!( List : "N" ) , ErrorFollowing ,
715723 INTERNAL_UNSTABLE
@@ -720,7 +728,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
720728 ) ,
721729 // Ensure the argument to this function is &&str during const-check.
722730 rustc_attr ! (
723- rustc_const_panic_str, Normal , template!( Word ) , WarnFollowing , INTERNAL_UNSTABLE
731+ rustc_const_panic_str, Normal , template!( Word ) ,
732+ WarnFollowing , INTERNAL_UNSTABLE
724733 ) ,
725734
726735 // ==========================================================================
@@ -784,7 +793,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
784793 the given type by annotating all impl items with #[rustc_allow_incoherent_impl]."
785794 ) ,
786795 rustc_attr ! (
787- rustc_box, AttributeType :: Normal , template!( Word ) , ErrorFollowing ,
796+ rustc_box, AttributeType :: Normal , template!( Word ) , ErrorFollowing , @only_local : true ,
788797 "#[rustc_box] allows creating boxes \
789798 and it is only intended to be used in `alloc`."
790799 ) ,
@@ -806,11 +815,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
806815 gated ! (
807816 // Used in resolve:
808817 prelude_import, Normal , template!( Word ) , WarnFollowing ,
809- "`#[prelude_import]` is for use by rustc only" ,
818+ @only_local : true , "`#[prelude_import]` is for use by rustc only" ,
810819 ) ,
811820 gated ! (
812- rustc_paren_sugar, Normal , template!( Word ) , WarnFollowing , unboxed_closures ,
813- "unboxed_closures are still evolving" ,
821+ rustc_paren_sugar, Normal , template!( Word ) , WarnFollowing , @only_local : true ,
822+ unboxed_closures , "unboxed_closures are still evolving" ,
814823 ) ,
815824 rustc_attr ! (
816825 rustc_inherit_overflow_checks, Normal , template!( Word ) , WarnFollowing , @only_local: true ,
@@ -826,37 +835,43 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
826835 ) ,
827836 rustc_attr ! (
828837 rustc_test_marker, Normal , template!( NameValueStr : "name" ) , WarnFollowing ,
829- "the `#[rustc_test_marker]` attribute is used internally to track tests" ,
838+ @only_local : true , "the `#[rustc_test_marker]` attribute is used internally to track tests" ,
830839 ) ,
831840 rustc_attr ! (
832- rustc_unsafe_specialization_marker, Normal , template!( Word ) , WarnFollowing ,
841+ rustc_unsafe_specialization_marker, Normal , template!( Word ) ,
842+ WarnFollowing , @only_local: true ,
833843 "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
834844 ) ,
835845 rustc_attr ! (
836- rustc_specialization_trait, Normal , template!( Word ) , WarnFollowing ,
846+ rustc_specialization_trait, Normal , template!( Word ) ,
847+ WarnFollowing , @only_local: true ,
837848 "the `#[rustc_specialization_trait]` attribute is used to check specializations"
838849 ) ,
839850 rustc_attr ! (
840- rustc_main, Normal , template!( Word ) , WarnFollowing ,
851+ rustc_main, Normal , template!( Word ) , WarnFollowing , @only_local : true ,
841852 "the `#[rustc_main]` attribute is used internally to specify test entry point function" ,
842853 ) ,
843854 rustc_attr ! (
844- rustc_skip_array_during_method_dispatch, Normal , template!( Word ) , WarnFollowing ,
855+ rustc_skip_array_during_method_dispatch, Normal , template!( Word ) ,
856+ WarnFollowing , @only_local: true ,
845857 "the `#[rustc_skip_array_during_method_dispatch]` attribute is used to exclude a trait \
846858 from method dispatch when the receiver is an array, for compatibility in editions < 2021."
847859 ) ,
848860 rustc_attr ! (
849- rustc_must_implement_one_of, Normal , template!( List : "function1, function2, ..." ) , ErrorFollowing ,
861+ rustc_must_implement_one_of, Normal , template!( List : "function1, function2, ..." ) ,
862+ ErrorFollowing , @only_local: true ,
850863 "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
851864 definition of a trait, it's currently in experimental form and should be changed before \
852865 being exposed outside of the std"
853866 ) ,
854867 rustc_attr ! (
855- rustc_doc_primitive, Normal , template!( NameValueStr : "primitive name" ) , ErrorFollowing ,
868+ rustc_doc_primitive, Normal , template!( NameValueStr : "primitive name" ) ,
869+ ErrorFollowing , @only_local: true ,
856870 r#"`rustc_doc_primitive` is a rustc internal attribute"# ,
857871 ) ,
858872 rustc_attr ! (
859873 rustc_safe_intrinsic, Normal , template!( Word ) , WarnFollowing ,
874+ @only_local: true ,
860875 "the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe"
861876 ) ,
862877 rustc_attr ! (
0 commit comments