Skip to content

Commit 9801c20

Browse files
authored
Unrolled build for #155006
Rollup merge of #155006 - WaffleLapkin:stabilize_cfg_target_has_atomic_equal_alignment, r=Urgau stabilize `feature(cfg_target_has_atomic_equal_alignment)` See stabilization report: #93822 (comment) cc @joshtriplett
2 parents 7517636 + 2f69883 commit 9801c20

17 files changed

Lines changed: 90 additions & 165 deletions

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ declare_features! (
108108
(accepted, cfg_target_abi, "1.78.0", Some(80970)),
109109
/// Allows `cfg(target_feature = "...")`.
110110
(accepted, cfg_target_feature, "1.27.0", Some(29717)),
111+
/// Allows `cfg(target_has_atomic_primitive_alignment = "...")`.
112+
(accepted, cfg_target_has_atomic_equal_alignment, "CURRENT_RUSTC_VERSION", Some(93822)),
111113
/// Allows `cfg(target_vendor = "...")`.
112114
(accepted, cfg_target_vendor, "1.33.0", Some(29718)),
113115
/// Allows implementing `Clone` for closures where possible (RFC 2132).

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ const GATED_CFGS: &[GatedCfg] = &[
2020
(sym::ub_checks, sym::cfg_ub_checks, Features::cfg_ub_checks),
2121
(sym::contract_checks, sym::cfg_contract_checks, Features::cfg_contract_checks),
2222
(sym::target_thread_local, sym::cfg_target_thread_local, Features::cfg_target_thread_local),
23-
(
24-
sym::target_has_atomic_equal_alignment,
25-
sym::cfg_target_has_atomic_equal_alignment,
26-
Features::cfg_target_has_atomic_equal_alignment,
27-
),
2823
(
2924
sym::target_has_atomic_load_store,
3025
sym::cfg_target_has_atomic,

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ declare_features! (
444444
(unstable, cfg_target_compact, "1.63.0", Some(96901)),
445445
/// Allows `cfg(target_has_atomic_load_store = "...")`.
446446
(unstable, cfg_target_has_atomic, "1.60.0", Some(94039)),
447-
/// Allows `cfg(target_has_atomic_equal_alignment = "...")`.
448-
(unstable, cfg_target_has_atomic_equal_alignment, "1.60.0", Some(93822)),
449447
/// Allows `cfg(target_object_format = "...")`.
450448
(unstable, cfg_target_object_format, "CURRENT_RUSTC_VERSION", Some(152586)),
451449
/// Allows `cfg(target_thread_local)`.

compiler/rustc_session/src/config/cfg.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub(crate) fn disallow_cfgs(sess: &Session, user_cfgs: &Cfg) {
149149
| (sym::target_pointer_width, Some(_))
150150
| (sym::target_vendor, None | Some(_))
151151
| (sym::target_has_atomic, Some(_))
152-
| (sym::target_has_atomic_equal_alignment, Some(_))
152+
| (sym::target_has_atomic_primitive_alignment, Some(_))
153153
| (sym::target_has_atomic_load_store, Some(_))
154154
| (sym::target_has_reliable_f16, None | Some(_))
155155
| (sym::target_has_reliable_f16_math, None | Some(_))
@@ -293,7 +293,7 @@ pub(crate) fn default_configuration(sess: &Session) -> Cfg {
293293
ins_sym!(sym::target_has_atomic, sym);
294294
}
295295
if align.bits() == i {
296-
ins_sym!(sym::target_has_atomic_equal_alignment, sym);
296+
ins_sym!(sym::target_has_atomic_primitive_alignment, sym);
297297
}
298298
ins_sym!(sym::target_has_atomic_load_store, sym);
299299
};
@@ -485,13 +485,10 @@ impl CheckCfg {
485485
sym::integer(64usize),
486486
sym::integer(128usize),
487487
];
488-
for sym in [
489-
sym::target_has_atomic,
490-
sym::target_has_atomic_equal_alignment,
491-
sym::target_has_atomic_load_store,
492-
] {
488+
for sym in [sym::target_has_atomic, sym::target_has_atomic_load_store] {
493489
ins!(sym, no_values).extend(atomic_values);
494490
}
491+
ins!(sym::target_has_atomic_primitive_alignment, empty_values).extend(atomic_values);
495492

496493
ins!(sym::target_thread_local, no_values);
497494

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2023,8 +2023,8 @@ symbols! {
20232023
target_feature_11,
20242024
target_feature_inline_always,
20252025
target_has_atomic,
2026-
target_has_atomic_equal_alignment,
20272026
target_has_atomic_load_store,
2027+
target_has_atomic_primitive_alignment,
20282028
target_has_reliable_f16,
20292029
target_has_reliable_f16_math,
20302030
target_has_reliable_f128,

library/core/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@
6161
target_has_atomic = "32",
6262
target_has_atomic = "64",
6363
target_has_atomic = "ptr",
64-
target_has_atomic_equal_alignment = "8",
65-
target_has_atomic_equal_alignment = "16",
66-
target_has_atomic_equal_alignment = "32",
67-
target_has_atomic_equal_alignment = "64",
68-
target_has_atomic_equal_alignment = "ptr",
64+
target_has_atomic_primitive_alignment = "8",
65+
target_has_atomic_primitive_alignment = "16",
66+
target_has_atomic_primitive_alignment = "32",
67+
target_has_atomic_primitive_alignment = "64",
68+
target_has_atomic_primitive_alignment = "ptr",
6969
target_has_atomic_load_store = "8",
7070
target_has_atomic_load_store = "16",
7171
target_has_atomic_load_store = "32",
@@ -123,7 +123,6 @@
123123
#![feature(auto_traits)]
124124
#![feature(cfg_sanitize)]
125125
#![feature(cfg_target_has_atomic)]
126-
#![feature(cfg_target_has_atomic_equal_alignment)]
127126
#![feature(cfg_ub_checks)]
128127
#![feature(const_closures)]
129128
#![feature(const_precise_live_drops)]

library/core/src/sync/atomic.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ impl AtomicBool {
622622
/// assert_eq!(some_bool, false);
623623
/// ```
624624
#[inline]
625-
#[cfg(target_has_atomic_equal_alignment = "8")]
625+
#[cfg(target_has_atomic_primitive_alignment = "8")]
626626
#[unstable(feature = "atomic_from_mut", issue = "76314")]
627627
pub fn from_mut(v: &mut bool) -> &mut Self {
628628
// SAFETY: the mutable reference guarantees unique ownership, and
@@ -682,7 +682,7 @@ impl AtomicBool {
682682
/// assert_eq!(some_bools, [true; 10]);
683683
/// ```
684684
#[inline]
685-
#[cfg(target_has_atomic_equal_alignment = "8")]
685+
#[cfg(target_has_atomic_primitive_alignment = "8")]
686686
#[unstable(feature = "atomic_from_mut", issue = "76314")]
687687
pub fn from_mut_slice(v: &mut [bool]) -> &mut [Self] {
688688
// SAFETY: the mutable reference guarantees unique ownership, and
@@ -1593,7 +1593,7 @@ impl<T> AtomicPtr<T> {
15931593
/// assert_eq!(unsafe { *some_ptr }, 456);
15941594
/// ```
15951595
#[inline]
1596-
#[cfg(target_has_atomic_equal_alignment = "ptr")]
1596+
#[cfg(target_has_atomic_primitive_alignment = "ptr")]
15971597
#[unstable(feature = "atomic_from_mut", issue = "76314")]
15981598
pub fn from_mut(v: &mut *mut T) -> &mut Self {
15991599
let [] = [(); align_of::<AtomicPtr<()>>() - align_of::<*mut ()>()];
@@ -1672,7 +1672,7 @@ impl<T> AtomicPtr<T> {
16721672
/// }
16731673
/// ```
16741674
#[inline]
1675-
#[cfg(target_has_atomic_equal_alignment = "ptr")]
1675+
#[cfg(target_has_atomic_primitive_alignment = "ptr")]
16761676
#[unstable(feature = "atomic_from_mut", issue = "76314")]
16771677
pub fn from_mut_slice(v: &mut [*mut T]) -> &mut [Self] {
16781678
// SAFETY:
@@ -3621,7 +3621,7 @@ macro_rules! atomic_int {
36213621
#[cfg(target_has_atomic_load_store = "8")]
36223622
atomic_int! {
36233623
cfg(target_has_atomic = "8"),
3624-
cfg(target_has_atomic_equal_alignment = "8"),
3624+
cfg(target_has_atomic_primitive_alignment = "8"),
36253625
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36263626
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36273627
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3639,7 +3639,7 @@ atomic_int! {
36393639
#[cfg(target_has_atomic_load_store = "8")]
36403640
atomic_int! {
36413641
cfg(target_has_atomic = "8"),
3642-
cfg(target_has_atomic_equal_alignment = "8"),
3642+
cfg(target_has_atomic_primitive_alignment = "8"),
36433643
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36443644
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36453645
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3657,7 +3657,7 @@ atomic_int! {
36573657
#[cfg(target_has_atomic_load_store = "16")]
36583658
atomic_int! {
36593659
cfg(target_has_atomic = "16"),
3660-
cfg(target_has_atomic_equal_alignment = "16"),
3660+
cfg(target_has_atomic_primitive_alignment = "16"),
36613661
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36623662
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36633663
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3675,7 +3675,7 @@ atomic_int! {
36753675
#[cfg(target_has_atomic_load_store = "16")]
36763676
atomic_int! {
36773677
cfg(target_has_atomic = "16"),
3678-
cfg(target_has_atomic_equal_alignment = "16"),
3678+
cfg(target_has_atomic_primitive_alignment = "16"),
36793679
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36803680
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36813681
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3693,7 +3693,7 @@ atomic_int! {
36933693
#[cfg(target_has_atomic_load_store = "32")]
36943694
atomic_int! {
36953695
cfg(target_has_atomic = "32"),
3696-
cfg(target_has_atomic_equal_alignment = "32"),
3696+
cfg(target_has_atomic_primitive_alignment = "32"),
36973697
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36983698
stable(feature = "integer_atomics_stable", since = "1.34.0"),
36993699
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3711,7 +3711,7 @@ atomic_int! {
37113711
#[cfg(target_has_atomic_load_store = "32")]
37123712
atomic_int! {
37133713
cfg(target_has_atomic = "32"),
3714-
cfg(target_has_atomic_equal_alignment = "32"),
3714+
cfg(target_has_atomic_primitive_alignment = "32"),
37153715
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37163716
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37173717
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3729,7 +3729,7 @@ atomic_int! {
37293729
#[cfg(target_has_atomic_load_store = "64")]
37303730
atomic_int! {
37313731
cfg(target_has_atomic = "64"),
3732-
cfg(target_has_atomic_equal_alignment = "64"),
3732+
cfg(target_has_atomic_primitive_alignment = "64"),
37333733
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37343734
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37353735
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3747,7 +3747,7 @@ atomic_int! {
37473747
#[cfg(target_has_atomic_load_store = "64")]
37483748
atomic_int! {
37493749
cfg(target_has_atomic = "64"),
3750-
cfg(target_has_atomic_equal_alignment = "64"),
3750+
cfg(target_has_atomic_primitive_alignment = "64"),
37513751
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37523752
stable(feature = "integer_atomics_stable", since = "1.34.0"),
37533753
stable(feature = "integer_atomics_stable", since = "1.34.0"),
@@ -3765,7 +3765,7 @@ atomic_int! {
37653765
#[cfg(target_has_atomic_load_store = "128")]
37663766
atomic_int! {
37673767
cfg(target_has_atomic = "128"),
3768-
cfg(target_has_atomic_equal_alignment = "128"),
3768+
cfg(target_has_atomic_primitive_alignment = "128"),
37693769
unstable(feature = "integer_atomics", issue = "99069"),
37703770
unstable(feature = "integer_atomics", issue = "99069"),
37713771
unstable(feature = "integer_atomics", issue = "99069"),
@@ -3783,7 +3783,7 @@ atomic_int! {
37833783
#[cfg(target_has_atomic_load_store = "128")]
37843784
atomic_int! {
37853785
cfg(target_has_atomic = "128"),
3786-
cfg(target_has_atomic_equal_alignment = "128"),
3786+
cfg(target_has_atomic_primitive_alignment = "128"),
37873787
unstable(feature = "integer_atomics", issue = "99069"),
37883788
unstable(feature = "integer_atomics", issue = "99069"),
37893789
unstable(feature = "integer_atomics", issue = "99069"),
@@ -3805,7 +3805,7 @@ macro_rules! atomic_int_ptr_sized {
38053805
#[cfg(target_pointer_width = $target_pointer_width)]
38063806
atomic_int! {
38073807
cfg(target_has_atomic = "ptr"),
3808-
cfg(target_has_atomic_equal_alignment = "ptr"),
3808+
cfg(target_has_atomic_primitive_alignment = "ptr"),
38093809
stable(feature = "rust1", since = "1.0.0"),
38103810
stable(feature = "extended_compare_and_swap", since = "1.10.0"),
38113811
stable(feature = "atomic_debug", since = "1.3.0"),
@@ -3823,7 +3823,7 @@ macro_rules! atomic_int_ptr_sized {
38233823
#[cfg(target_pointer_width = $target_pointer_width)]
38243824
atomic_int! {
38253825
cfg(target_has_atomic = "ptr"),
3826-
cfg(target_has_atomic_equal_alignment = "ptr"),
3826+
cfg(target_has_atomic_primitive_alignment = "ptr"),
38273827
stable(feature = "rust1", since = "1.0.0"),
38283828
stable(feature = "extended_compare_and_swap", since = "1.10.0"),
38293829
stable(feature = "atomic_debug", since = "1.3.0"),

src/doc/rustc/src/check-cfg.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ the need to specify them manually.
9999
Well known names and values are implicitly added as long as at least one `--check-cfg` argument
100100
is present.
101101
102-
As of `2025-01-02T`, the list of known names is as follows:
102+
As of `2026-05-15T`, the list of known names is as follows:
103103
104104
<!--- See CheckCfg::fill_well_known in compiler/rustc_session/src/config.rs -->
105105
@@ -122,15 +122,17 @@ As of `2025-01-02T`, the list of known names is as follows:
122122
- `target_endian`
123123
- `target_env`
124124
- `target_family`
125+
- `target_object_format`
125126
- `target_feature`
126127
- `target_has_atomic`
127-
- `target_has_atomic_equal_alignment`
128+
- `target_has_atomic_primitive_alignment`
128129
- `target_has_atomic_load_store`
129130
- `target_os`
130131
- `target_pointer_width`
131132
- `target_thread_local`
132133
- `target_vendor`
133134
- `ub_checks`
135+
- `contract_checks`
134136
- `unix`
135137
- `windows`
136138

tests/ui/cfg/disallowed-cli-cfgs.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
// ignore-tidy-linelength (target_has_atomic_primitive_alignment below overflows the linelength limit and @ [revision]compile-flags isn't detected by tidy as something to ignore)
2+
13
//@ check-fail
24
//@ revisions: overflow_checks_ debug_assertions_ ub_checks_ sanitize_
35
//@ revisions: sanitizer_cfi_generalize_pointers_ sanitizer_cfi_normalize_integers_
46
//@ revisions: proc_macro_ panic_ target_feature_ unix_ windows_ target_abi_
57
//@ revisions: target_arch_ target_endian_ target_env_ target_family_ target_os_
68
//@ revisions: target_object_format_ target_pointer_width_ target_vendor_
7-
//@ revisions: target_has_atomic_ target_has_atomic_equal_alignment_
9+
//@ revisions: target_has_atomic_ target_has_atomic_primitive_alignment_
810
//@ revisions: target_has_atomic_load_store_ target_thread_local_ relocation_model_
911
//@ revisions: fmt_debug_
1012
//@ revisions: emscripten_wasm_eh_
@@ -31,7 +33,7 @@
3133
//@ [target_pointer_width_]compile-flags: --cfg target_pointer_width="32"
3234
//@ [target_vendor_]compile-flags: --cfg target_vendor
3335
//@ [target_has_atomic_]compile-flags: --cfg target_has_atomic="32"
34-
//@ [target_has_atomic_equal_alignment_]compile-flags: --cfg target_has_atomic_equal_alignment="32"
36+
//@ [target_has_atomic_primitive_alignment_]compile-flags: --cfg target_has_atomic_primitive_alignment="32"
3537
//@ [target_has_atomic_load_store_]compile-flags: --cfg target_has_atomic_load_store="32"
3638
//@ [target_thread_local_]compile-flags: --cfg target_thread_local
3739
//@ [relocation_model_]compile-flags: --cfg relocation_model="a"

tests/ui/cfg/disallowed-cli-cfgs.target_has_atomic_equal_alignment_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
error: unexpected `--cfg target_has_atomic_equal_alignment="32"` flag
1+
error: unexpected `--cfg target_has_atomic_primitive_alignment="32"` flag
22
|
3-
= note: config `target_has_atomic_equal_alignment` is only supposed to be controlled by `--target`
3+
= note: config `target_has_atomic_primitive_alignment` is only supposed to be controlled by `--target`
44
= note: manually setting a built-in cfg can and does create incoherent behaviors
55
= note: `#[deny(explicit_builtin_cfgs_in_flags)]` on by default
66

0 commit comments

Comments
 (0)