Skip to content

Commit d26f0b7

Browse files
committed
Auto merge of rust-lang#105571 - kadiwa4:remove_atomic_init_consts, r=Amanieu
remove the unstable `core::sync::atomic::ATOMIC_*_INIT` constants Tracking issue: rust-lang#99069 It would be weird to ever stabilise these as they are already deprecated.
2 parents c720a9c + c3462a0 commit d26f0b7

File tree

2 files changed

+36
-51
lines changed

2 files changed

+36
-51
lines changed

library/core/src/sync/atomic.rs

+35-50
Original file line numberDiff line numberDiff line change
@@ -1958,14 +1958,12 @@ macro_rules! atomic_int {
19581958
$stable_from:meta,
19591959
$stable_nand:meta,
19601960
$const_stable:meta,
1961-
$stable_init_const:meta,
19621961
$diagnostic_item:meta,
19631962
$s_int_type:literal,
19641963
$extra_feature:expr,
19651964
$min_fn:ident, $max_fn:ident,
19661965
$align:expr,
1967-
$atomic_new:expr,
1968-
$int_type:ident $atomic_type:ident $atomic_init:ident) => {
1966+
$int_type:ident $atomic_type:ident) => {
19691967
/// An integer type which can be safely shared between threads.
19701968
///
19711969
/// This type has the same in-memory representation as the underlying
@@ -1988,15 +1986,6 @@ macro_rules! atomic_int {
19881986
v: UnsafeCell<$int_type>,
19891987
}
19901988

1991-
/// An atomic integer initialized to `0`.
1992-
#[$stable_init_const]
1993-
#[deprecated(
1994-
since = "1.34.0",
1995-
note = "the `new` function is now preferred",
1996-
suggestion = $atomic_new,
1997-
)]
1998-
pub const $atomic_init: $atomic_type = $atomic_type::new(0);
1999-
20001989
#[$stable]
20011990
impl Default for $atomic_type {
20021991
#[inline]
@@ -2874,14 +2863,12 @@ atomic_int! {
28742863
stable(feature = "integer_atomics_stable", since = "1.34.0"),
28752864
stable(feature = "integer_atomics_stable", since = "1.34.0"),
28762865
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2877-
unstable(feature = "integer_atomics", issue = "99069"),
28782866
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI8"),
28792867
"i8",
28802868
"",
28812869
atomic_min, atomic_max,
28822870
1,
2883-
"AtomicI8::new(0)",
2884-
i8 AtomicI8 ATOMIC_I8_INIT
2871+
i8 AtomicI8
28852872
}
28862873
#[cfg(target_has_atomic_load_store = "8")]
28872874
atomic_int! {
@@ -2894,14 +2881,12 @@ atomic_int! {
28942881
stable(feature = "integer_atomics_stable", since = "1.34.0"),
28952882
stable(feature = "integer_atomics_stable", since = "1.34.0"),
28962883
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2897-
unstable(feature = "integer_atomics", issue = "99069"),
28982884
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU8"),
28992885
"u8",
29002886
"",
29012887
atomic_umin, atomic_umax,
29022888
1,
2903-
"AtomicU8::new(0)",
2904-
u8 AtomicU8 ATOMIC_U8_INIT
2889+
u8 AtomicU8
29052890
}
29062891
#[cfg(target_has_atomic_load_store = "16")]
29072892
atomic_int! {
@@ -2914,14 +2899,12 @@ atomic_int! {
29142899
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29152900
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29162901
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2917-
unstable(feature = "integer_atomics", issue = "99069"),
29182902
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI16"),
29192903
"i16",
29202904
"",
29212905
atomic_min, atomic_max,
29222906
2,
2923-
"AtomicI16::new(0)",
2924-
i16 AtomicI16 ATOMIC_I16_INIT
2907+
i16 AtomicI16
29252908
}
29262909
#[cfg(target_has_atomic_load_store = "16")]
29272910
atomic_int! {
@@ -2934,14 +2917,12 @@ atomic_int! {
29342917
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29352918
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29362919
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2937-
unstable(feature = "integer_atomics", issue = "99069"),
29382920
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU16"),
29392921
"u16",
29402922
"",
29412923
atomic_umin, atomic_umax,
29422924
2,
2943-
"AtomicU16::new(0)",
2944-
u16 AtomicU16 ATOMIC_U16_INIT
2925+
u16 AtomicU16
29452926
}
29462927
#[cfg(target_has_atomic_load_store = "32")]
29472928
atomic_int! {
@@ -2954,14 +2935,12 @@ atomic_int! {
29542935
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29552936
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29562937
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2957-
unstable(feature = "integer_atomics", issue = "99069"),
29582938
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI32"),
29592939
"i32",
29602940
"",
29612941
atomic_min, atomic_max,
29622942
4,
2963-
"AtomicI32::new(0)",
2964-
i32 AtomicI32 ATOMIC_I32_INIT
2943+
i32 AtomicI32
29652944
}
29662945
#[cfg(target_has_atomic_load_store = "32")]
29672946
atomic_int! {
@@ -2974,14 +2953,12 @@ atomic_int! {
29742953
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29752954
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29762955
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2977-
unstable(feature = "integer_atomics", issue = "99069"),
29782956
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU32"),
29792957
"u32",
29802958
"",
29812959
atomic_umin, atomic_umax,
29822960
4,
2983-
"AtomicU32::new(0)",
2984-
u32 AtomicU32 ATOMIC_U32_INIT
2961+
u32 AtomicU32
29852962
}
29862963
#[cfg(target_has_atomic_load_store = "64")]
29872964
atomic_int! {
@@ -2994,14 +2971,12 @@ atomic_int! {
29942971
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29952972
stable(feature = "integer_atomics_stable", since = "1.34.0"),
29962973
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
2997-
unstable(feature = "integer_atomics", issue = "99069"),
29982974
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI64"),
29992975
"i64",
30002976
"",
30012977
atomic_min, atomic_max,
30022978
8,
3003-
"AtomicI64::new(0)",
3004-
i64 AtomicI64 ATOMIC_I64_INIT
2979+
i64 AtomicI64
30052980
}
30062981
#[cfg(target_has_atomic_load_store = "64")]
30072982
atomic_int! {
@@ -3014,14 +2989,12 @@ atomic_int! {
30142989
stable(feature = "integer_atomics_stable", since = "1.34.0"),
30152990
stable(feature = "integer_atomics_stable", since = "1.34.0"),
30162991
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
3017-
unstable(feature = "integer_atomics", issue = "99069"),
30182992
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU64"),
30192993
"u64",
30202994
"",
30212995
atomic_umin, atomic_umax,
30222996
8,
3023-
"AtomicU64::new(0)",
3024-
u64 AtomicU64 ATOMIC_U64_INIT
2997+
u64 AtomicU64
30252998
}
30262999
#[cfg(target_has_atomic_load_store = "128")]
30273000
atomic_int! {
@@ -3034,14 +3007,12 @@ atomic_int! {
30343007
unstable(feature = "integer_atomics", issue = "99069"),
30353008
unstable(feature = "integer_atomics", issue = "99069"),
30363009
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
3037-
unstable(feature = "integer_atomics", issue = "99069"),
30383010
cfg_attr(not(test), rustc_diagnostic_item = "AtomicI128"),
30393011
"i128",
30403012
"#![feature(integer_atomics)]\n\n",
30413013
atomic_min, atomic_max,
30423014
16,
3043-
"AtomicI128::new(0)",
3044-
i128 AtomicI128 ATOMIC_I128_INIT
3015+
i128 AtomicI128
30453016
}
30463017
#[cfg(target_has_atomic_load_store = "128")]
30473018
atomic_int! {
@@ -3054,19 +3025,17 @@ atomic_int! {
30543025
unstable(feature = "integer_atomics", issue = "99069"),
30553026
unstable(feature = "integer_atomics", issue = "99069"),
30563027
rustc_const_stable(feature = "const_integer_atomics", since = "1.34.0"),
3057-
unstable(feature = "integer_atomics", issue = "99069"),
30583028
cfg_attr(not(test), rustc_diagnostic_item = "AtomicU128"),
30593029
"u128",
30603030
"#![feature(integer_atomics)]\n\n",
30613031
atomic_umin, atomic_umax,
30623032
16,
3063-
"AtomicU128::new(0)",
3064-
u128 AtomicU128 ATOMIC_U128_INIT
3033+
u128 AtomicU128
30653034
}
30663035

3036+
#[cfg(target_has_atomic_load_store = "ptr")]
30673037
macro_rules! atomic_int_ptr_sized {
30683038
( $($target_pointer_width:literal $align:literal)* ) => { $(
3069-
#[cfg(target_has_atomic_load_store = "ptr")]
30703039
#[cfg(target_pointer_width = $target_pointer_width)]
30713040
atomic_int! {
30723041
cfg(target_has_atomic = "ptr"),
@@ -3078,16 +3047,13 @@ macro_rules! atomic_int_ptr_sized {
30783047
stable(feature = "atomic_from", since = "1.23.0"),
30793048
stable(feature = "atomic_nand", since = "1.27.0"),
30803049
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
3081-
stable(feature = "rust1", since = "1.0.0"),
30823050
cfg_attr(not(test), rustc_diagnostic_item = "AtomicIsize"),
30833051
"isize",
30843052
"",
30853053
atomic_min, atomic_max,
30863054
$align,
3087-
"AtomicIsize::new(0)",
3088-
isize AtomicIsize ATOMIC_ISIZE_INIT
3055+
isize AtomicIsize
30893056
}
3090-
#[cfg(target_has_atomic_load_store = "ptr")]
30913057
#[cfg(target_pointer_width = $target_pointer_width)]
30923058
atomic_int! {
30933059
cfg(target_has_atomic = "ptr"),
@@ -3099,18 +3065,37 @@ macro_rules! atomic_int_ptr_sized {
30993065
stable(feature = "atomic_from", since = "1.23.0"),
31003066
stable(feature = "atomic_nand", since = "1.27.0"),
31013067
rustc_const_stable(feature = "const_ptr_sized_atomics", since = "1.24.0"),
3102-
stable(feature = "rust1", since = "1.0.0"),
31033068
cfg_attr(not(test), rustc_diagnostic_item = "AtomicUsize"),
31043069
"usize",
31053070
"",
31063071
atomic_umin, atomic_umax,
31073072
$align,
3108-
"AtomicUsize::new(0)",
3109-
usize AtomicUsize ATOMIC_USIZE_INIT
3073+
usize AtomicUsize
31103074
}
3075+
3076+
/// An [`AtomicIsize`] initialized to `0`.
3077+
#[cfg(target_pointer_width = $target_pointer_width)]
3078+
#[stable(feature = "rust1", since = "1.0.0")]
3079+
#[deprecated(
3080+
since = "1.34.0",
3081+
note = "the `new` function is now preferred",
3082+
suggestion = "AtomicIsize::new(0)",
3083+
)]
3084+
pub const ATOMIC_ISIZE_INIT: AtomicIsize = AtomicIsize::new(0);
3085+
3086+
/// An [`AtomicUsize`] initialized to `0`.
3087+
#[cfg(target_pointer_width = $target_pointer_width)]
3088+
#[stable(feature = "rust1", since = "1.0.0")]
3089+
#[deprecated(
3090+
since = "1.34.0",
3091+
note = "the `new` function is now preferred",
3092+
suggestion = "AtomicUsize::new(0)",
3093+
)]
3094+
pub const ATOMIC_USIZE_INIT: AtomicUsize = AtomicUsize::new(0);
31113095
)* };
31123096
}
31133097

3098+
#[cfg(target_has_atomic_load_store = "ptr")]
31143099
atomic_int_ptr_sized! {
31153100
"16" 2
31163101
"32" 4

library/core/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
#![feature(const_option)]
9494
#![feature(const_option_ext)]
9595
#![feature(const_result)]
96-
#![feature(integer_atomics)]
96+
#![cfg_attr(target_has_atomic = "128", feature(integer_atomics))]
9797
#![feature(int_roundings)]
9898
#![feature(slice_group_by)]
9999
#![feature(split_array)]

0 commit comments

Comments
 (0)