Skip to content
/ rust Public
forked from rust-lang/rust

Commit 4010270

Browse files
authored
Rollup merge of rust-lang#121740 - surechen:change_attribute_to_local_20240228, r=lcnr
Changing some attributes to only_local. Modified according to rust-lang/compiler-team#505. r? `@lcnr`
2 parents cecc2a4 + 11f9489 commit 4010270

File tree

1 file changed

+45
-18
lines changed

1 file changed

+45
-18
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

+45-18
Original file line numberDiff line numberDiff line change
@@ -555,56 +555,80 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
555555
),
556556
gated!(
557557
rustc_allow_const_fn_unstable, Normal,
558-
template!(Word, List: "feat1, feat2, ..."), DuplicatesOk,
558+
template!(Word, List: "feat1, feat2, ..."), DuplicatesOk, @only_local: true,
559559
"rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
560560
),
561561
gated!(
562562
allow_internal_unsafe, Normal, template!(Word), WarnFollowing,
563-
"allow_internal_unsafe side-steps the unsafe_code lint",
563+
@only_local: true, "allow_internal_unsafe side-steps the unsafe_code lint",
564+
),
565+
rustc_attr!(
566+
rustc_allowed_through_unstable_modules, Normal, template!(Word),
567+
WarnFollowing, @only_local: true,
568+
"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
569+
through unstable paths"
564570
),
565-
rustc_attr!(rustc_allowed_through_unstable_modules, Normal, template!(Word), WarnFollowing,
566-
"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
567-
through unstable paths"),
568571

569572
// ==========================================================================
570573
// Internal attributes: Type system related:
571574
// ==========================================================================
572575

573576
gated!(fundamental, Normal, template!(Word), WarnFollowing, experimental!(fundamental)),
574577
gated!(
575-
may_dangle, Normal, template!(Word), WarnFollowing, dropck_eyepatch,
578+
may_dangle, Normal, template!(Word), WarnFollowing,
579+
@only_local: true, dropck_eyepatch,
576580
"`may_dangle` has unstable semantics and may be removed in the future",
577581
),
578582

579583
// ==========================================================================
580584
// Internal attributes: Runtime related:
581585
// ==========================================================================
582586

583-
rustc_attr!(rustc_allocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
584-
rustc_attr!(rustc_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
585-
rustc_attr!(rustc_reallocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
586-
rustc_attr!(rustc_deallocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
587-
rustc_attr!(rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
587+
rustc_attr!(
588+
rustc_allocator, Normal, template!(Word), WarnFollowing,
589+
@only_local: true, IMPL_DETAIL
590+
),
591+
rustc_attr!(
592+
rustc_nounwind, Normal, template!(Word), WarnFollowing,
593+
@only_local: true, IMPL_DETAIL
594+
),
595+
rustc_attr!(
596+
rustc_reallocator, Normal, template!(Word), WarnFollowing,
597+
@only_local: true, IMPL_DETAIL
598+
),
599+
rustc_attr!(
600+
rustc_deallocator, Normal, template!(Word), WarnFollowing,
601+
@only_local: true, IMPL_DETAIL
602+
),
603+
rustc_attr!(
604+
rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing,
605+
@only_local: true, IMPL_DETAIL
606+
),
607+
gated!(
608+
default_lib_allocator, Normal, template!(Word), WarnFollowing,
609+
@only_local: true, allocator_internals, experimental!(default_lib_allocator),
610+
),
588611
gated!(
589-
default_lib_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
590-
experimental!(default_lib_allocator),
612+
needs_allocator, Normal, template!(Word), WarnFollowing,
613+
@only_local: true, allocator_internals, experimental!(needs_allocator),
591614
),
592615
gated!(
593-
needs_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
594-
experimental!(needs_allocator),
616+
panic_runtime, Normal, template!(Word), WarnFollowing,
617+
@only_local: true, experimental!(panic_runtime)
595618
),
596-
gated!(panic_runtime, Normal, template!(Word), WarnFollowing, experimental!(panic_runtime)),
597619
gated!(
598620
needs_panic_runtime, Normal, template!(Word), WarnFollowing,
599-
experimental!(needs_panic_runtime)
621+
@only_local: true, experimental!(needs_panic_runtime)
600622
),
601623
gated!(
602624
compiler_builtins, Normal, template!(Word), WarnFollowing,
625+
@only_local: true,
603626
"the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
604627
which contains compiler-rt intrinsics and will never be stable",
605628
),
606629
gated!(
607630
profiler_runtime, Normal, template!(Word), WarnFollowing,
631+
@only_local: true,
608632
"the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
609633
which contains the profiler runtime and will never be stable",
610634
),
@@ -630,7 +654,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
630654
template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing,
631655
IMPL_DETAIL,
632656
),
633-
rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
657+
rustc_attr!(
658+
rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing,
659+
@only_local: true, INTERNAL_UNSTABLE
660+
),
634661
rustc_attr!(
635662
rustc_macro_transparency, Normal,
636663
template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing,

0 commit comments

Comments
 (0)