Skip to content

Commit 79f0fde

Browse files
committed
Change some attributes to only_local.
Modified according to rust-lang/compiler-team#505.
1 parent 70aa0b8 commit 79f0fde

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

+28-14
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,9 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
709709
// Internal attributes, Const related:
710710
// ==========================================================================
711711

712-
rustc_attr!(rustc_promotable, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
712+
rustc_attr!(
713+
rustc_promotable, Normal, template!(Word), WarnFollowing,
714+
@only_local: true, IMPL_DETAIL),
713715
rustc_attr!(
714716
rustc_legacy_const_generics, Normal, template!(List: "N"), ErrorFollowing,
715717
INTERNAL_UNSTABLE
@@ -720,7 +722,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
720722
),
721723
// Ensure the argument to this function is &&str during const-check.
722724
rustc_attr!(
723-
rustc_const_panic_str, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE
725+
rustc_const_panic_str, Normal, template!(Word),
726+
WarnFollowing, INTERNAL_UNSTABLE
724727
),
725728

726729
// ==========================================================================
@@ -784,7 +787,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
784787
the given type by annotating all impl items with #[rustc_allow_incoherent_impl]."
785788
),
786789
rustc_attr!(
787-
rustc_box, AttributeType::Normal, template!(Word), ErrorFollowing,
790+
rustc_box, AttributeType::Normal, template!(Word), ErrorFollowing, @only_local: true,
788791
"#[rustc_box] allows creating boxes \
789792
and it is only intended to be used in `alloc`."
790793
),
@@ -806,11 +809,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
806809
gated!(
807810
// Used in resolve:
808811
prelude_import, Normal, template!(Word), WarnFollowing,
809-
"`#[prelude_import]` is for use by rustc only",
812+
@only_local: true, "`#[prelude_import]` is for use by rustc only",
810813
),
811814
gated!(
812-
rustc_paren_sugar, Normal, template!(Word), WarnFollowing, unboxed_closures,
813-
"unboxed_closures are still evolving",
815+
rustc_paren_sugar, Normal, template!(Word), WarnFollowing, @only_local: true,
816+
unboxed_closures, "unboxed_closures are still evolving",
814817
),
815818
rustc_attr!(
816819
rustc_inherit_overflow_checks, Normal, template!(Word), WarnFollowing, @only_local: true,
@@ -826,27 +829,31 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
826829
),
827830
rustc_attr!(
828831
rustc_test_marker, Normal, template!(NameValueStr: "name"), WarnFollowing,
829-
"the `#[rustc_test_marker]` attribute is used internally to track tests",
832+
@only_local: true, "the `#[rustc_test_marker]` attribute is used internally to track tests",
830833
),
831834
rustc_attr!(
832-
rustc_unsafe_specialization_marker, Normal, template!(Word), WarnFollowing,
835+
rustc_unsafe_specialization_marker, Normal, template!(Word),
836+
WarnFollowing, @only_local: true,
833837
"the `#[rustc_unsafe_specialization_marker]` attribute is used to check specializations"
834838
),
835839
rustc_attr!(
836-
rustc_specialization_trait, Normal, template!(Word), WarnFollowing,
840+
rustc_specialization_trait, Normal, template!(Word),
841+
WarnFollowing, @only_local: true,
837842
"the `#[rustc_specialization_trait]` attribute is used to check specializations"
838843
),
839844
rustc_attr!(
840-
rustc_main, Normal, template!(Word), WarnFollowing,
845+
rustc_main, Normal, template!(Word), WarnFollowing, @only_local: true,
841846
"the `#[rustc_main]` attribute is used internally to specify test entry point function",
842847
),
843848
rustc_attr!(
844-
rustc_skip_array_during_method_dispatch, Normal, template!(Word), WarnFollowing,
849+
rustc_skip_array_during_method_dispatch, Normal, template!(Word),
850+
WarnFollowing, @only_local: true,
845851
"the `#[rustc_skip_array_during_method_dispatch]` attribute is used to exclude a trait \
846852
from method dispatch when the receiver is an array, for compatibility in editions < 2021."
847853
),
848854
rustc_attr!(
849-
rustc_must_implement_one_of, Normal, template!(List: "function1, function2, ..."), ErrorFollowing,
855+
rustc_must_implement_one_of, Normal, template!(List: "function1, function2, ..."),
856+
ErrorFollowing, @only_local: true,
850857
"the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete \
851858
definition of a trait, it's currently in experimental form and should be changed before \
852859
being exposed outside of the std"
@@ -857,6 +864,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
857864
),
858865
rustc_attr!(
859866
rustc_safe_intrinsic, Normal, template!(Word), WarnFollowing,
867+
@only_local: true,
860868
"the `#[rustc_safe_intrinsic]` attribute is used internally to mark intrinsics as safe"
861869
),
862870
rustc_attr!(
@@ -873,8 +881,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
873881
// ==========================================================================
874882

875883
rustc_attr!(TEST, rustc_effective_visibility, Normal, template!(Word), WarnFollowing),
876-
rustc_attr!(TEST, rustc_outlives, Normal, template!(Word), WarnFollowing),
877-
rustc_attr!(TEST, rustc_capture_analysis, Normal, template!(Word), WarnFollowing),
884+
rustc_attr!(
885+
TEST, rustc_outlives, Normal, template!(Word),
886+
WarnFollowing, @only_local: true
887+
),
888+
rustc_attr!(
889+
TEST, rustc_capture_analysis, Normal, template!(Word),
890+
WarnFollowing, @only_local: true
891+
),
878892
rustc_attr!(TEST, rustc_insignificant_dtor, Normal, template!(Word), WarnFollowing),
879893
rustc_attr!(TEST, rustc_strict_coherence, Normal, template!(Word), WarnFollowing),
880894
rustc_attr!(TEST, rustc_variance, Normal, template!(Word), WarnFollowing),

0 commit comments

Comments
 (0)