@@ -700,27 +700,37 @@ 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
716724 ) ,
717725 // Do not const-check this function's body. It will always get replaced during CTFE.
718726 rustc_attr ! (
719- rustc_do_not_const_check, Normal , template!( Word ) , WarnFollowing , INTERNAL_UNSTABLE
727+ rustc_do_not_const_check, Normal , template!( Word ) ,
728+ WarnFollowing , @only_local: true , INTERNAL_UNSTABLE
720729 ) ,
721730 // Ensure the argument to this function is &&str during const-check.
722731 rustc_attr ! (
723- rustc_const_panic_str, Normal , template!( Word ) , WarnFollowing , INTERNAL_UNSTABLE
732+ rustc_const_panic_str, Normal , template!( Word ) ,
733+ WarnFollowing , INTERNAL_UNSTABLE
724734 ) ,
725735
726736 // ==========================================================================
@@ -784,7 +794,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
784794 the given type by annotating all impl items with #[rustc_allow_incoherent_impl]."
785795 ) ,
786796 rustc_attr ! (
787- rustc_box, AttributeType :: Normal , template!( Word ) , ErrorFollowing ,
797+ rustc_box, AttributeType :: Normal , template!( Word ) , ErrorFollowing , @only_local : true ,
788798 "#[rustc_box] allows creating boxes \
789799 and it is only intended to be used in `alloc`."
790800 ) ,
@@ -806,11 +816,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
806816 gated ! (
807817 // Used in resolve:
808818 prelude_import, Normal , template!( Word ) , WarnFollowing ,
809- "`#[prelude_import]` is for use by rustc only" ,
819+ @only_local : true , "`#[prelude_import]` is for use by rustc only" ,
810820 ) ,
811821 gated ! (
812- rustc_paren_sugar, Normal , template!( Word ) , WarnFollowing , unboxed_closures ,
813- "unboxed_closures are still evolving" ,
822+ rustc_paren_sugar, Normal , template!( Word ) , WarnFollowing , @only_local : true ,
823+ unboxed_closures , "unboxed_closures are still evolving" ,
814824 ) ,
815825 rustc_attr ! (
816826 rustc_inherit_overflow_checks, Normal , template!( Word ) , WarnFollowing , @only_local: true ,
@@ -826,37 +836,43 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
826836 ) ,
827837 rustc_attr ! (
828838 rustc_test_marker, Normal , template!( NameValueStr : "name" ) , WarnFollowing ,
829- "the `#[rustc_test_marker]` attribute is used internally to track tests" ,
839+ @only_local : true , "the `#[rustc_test_marker]` attribute is used internally to track tests" ,
830840 ) ,
831841 rustc_attr ! (
832- rustc_unsafe_specialization_marker, Normal , template!( Word ) , WarnFollowing ,
842+ rustc_unsafe_specialization_marker, Normal , template!( Word ) ,
843+ WarnFollowing , @only_local: true ,
833844 "the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
834845 ) ,
835846 rustc_attr ! (
836- rustc_specialization_trait, Normal , template!( Word ) , WarnFollowing ,
847+ rustc_specialization_trait, Normal , template!( Word ) ,
848+ WarnFollowing , @only_local: true ,
837849 "the `#[rustc_specialization_trait]` attribute is used to check specializations"
838850 ) ,
839851 rustc_attr ! (
840- rustc_main, Normal , template!( Word ) , WarnFollowing ,
852+ rustc_main, Normal , template!( Word ) , WarnFollowing , @only_local : true ,
841853 "the `#[rustc_main]` attribute is used internally to specify test entry point function" ,
842854 ) ,
843855 rustc_attr ! (
844- rustc_skip_array_during_method_dispatch, Normal , template!( Word ) , WarnFollowing ,
856+ rustc_skip_array_during_method_dispatch, Normal , template!( Word ) ,
857+ WarnFollowing , @only_local: true ,
845858 "the `#[rustc_skip_array_during_method_dispatch]` attribute is used to exclude a trait \
846859 from method dispatch when the receiver is an array, for compatibility in editions < 2021."
847860 ) ,
848861 rustc_attr ! (
849- rustc_must_implement_one_of, Normal , template!( List : "function1, function2, ..." ) , ErrorFollowing ,
862+ rustc_must_implement_one_of, Normal , template!( List : "function1, function2, ..." ) ,
863+ ErrorFollowing , @only_local: true ,
850864 "the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
851865 definition of a trait, it's currently in experimental form and should be changed before \
852866 being exposed outside of the std"
853867 ) ,
854868 rustc_attr ! (
855- rustc_doc_primitive, Normal , template!( NameValueStr : "primitive name" ) , ErrorFollowing ,
869+ rustc_doc_primitive, Normal , template!( NameValueStr : "primitive name" ) ,
870+ ErrorFollowing , @only_local: true ,
856871 r#"`rustc_doc_primitive` is a rustc internal attribute"# ,
857872 ) ,
858873 rustc_attr ! (
859874 rustc_safe_intrinsic, Normal , template!( Word ) , WarnFollowing ,
875+ @only_local: true ,
860876 "the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe"
861877 ) ,
862878 rustc_attr ! (
0 commit comments