@@ -290,7 +290,15 @@ pub enum Ordering {
290
290
/// [`AtomicBool`]: struct.AtomicBool.html
291
291
#[ cfg( target_has_atomic = "8" ) ]
292
292
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
293
- #[ rustc_deprecated( since = "1.34.0" , reason = "the `new` function is now preferred" ) ]
293
+ #[ cfg_attr( not( stage0) , rustc_deprecated(
294
+ since = "1.34.0" ,
295
+ reason = "the `new` function is now preferred" ,
296
+ suggestion = "AtomicBool::new(false)" ,
297
+ ) ) ]
298
+ #[ cfg_attr( stage0, rustc_deprecated(
299
+ since = "1.34.0" ,
300
+ reason = "the `new` function is now preferred" ,
301
+ ) ) ]
294
302
pub const ATOMIC_BOOL_INIT : AtomicBool = AtomicBool :: new ( false ) ;
295
303
296
304
#[ cfg( target_has_atomic = "8" ) ]
@@ -1127,6 +1135,7 @@ macro_rules! atomic_int {
1127
1135
$extra_feature: expr,
1128
1136
$min_fn: ident, $max_fn: ident,
1129
1137
$align: expr,
1138
+ $atomic_new: expr,
1130
1139
$int_type: ident $atomic_type: ident $atomic_init: ident) => {
1131
1140
/// An integer type which can be safely shared between threads.
1132
1141
///
@@ -1148,7 +1157,15 @@ macro_rules! atomic_int {
1148
1157
1149
1158
/// An atomic integer initialized to `0`.
1150
1159
#[ $stable]
1151
- #[ rustc_deprecated( since = "1.34.0" , reason = "the `new` function is now preferred" ) ]
1160
+ #[ cfg_attr( stage0, rustc_deprecated(
1161
+ since = "1.34.0" ,
1162
+ reason = "the `new` function is now preferred" ,
1163
+ ) ) ]
1164
+ #[ cfg_attr( not( stage0) , rustc_deprecated(
1165
+ since = "1.34.0" ,
1166
+ reason = "the `new` function is now preferred" ,
1167
+ suggestion = $atomic_new,
1168
+ ) ) ]
1152
1169
pub const $atomic_init: $atomic_type = $atomic_type:: new( 0 ) ;
1153
1170
1154
1171
#[ $stable]
@@ -1878,6 +1895,7 @@ atomic_int! {
1878
1895
"#![feature(integer_atomics)]\n \n " ,
1879
1896
atomic_min, atomic_max,
1880
1897
1 ,
1898
+ "AtomicI8::new(0)" ,
1881
1899
i8 AtomicI8 ATOMIC_I8_INIT
1882
1900
}
1883
1901
#[ cfg( target_has_atomic = "8" ) ]
@@ -1892,6 +1910,7 @@ atomic_int! {
1892
1910
"#![feature(integer_atomics)]\n \n " ,
1893
1911
atomic_umin, atomic_umax,
1894
1912
1 ,
1913
+ "AtomicU8::new(0)" ,
1895
1914
u8 AtomicU8 ATOMIC_U8_INIT
1896
1915
}
1897
1916
#[ cfg( target_has_atomic = "16" ) ]
@@ -1906,6 +1925,7 @@ atomic_int! {
1906
1925
"#![feature(integer_atomics)]\n \n " ,
1907
1926
atomic_min, atomic_max,
1908
1927
2 ,
1928
+ "AtomicI16::new(0)" ,
1909
1929
i16 AtomicI16 ATOMIC_I16_INIT
1910
1930
}
1911
1931
#[ cfg( target_has_atomic = "16" ) ]
@@ -1920,6 +1940,7 @@ atomic_int! {
1920
1940
"#![feature(integer_atomics)]\n \n " ,
1921
1941
atomic_umin, atomic_umax,
1922
1942
2 ,
1943
+ "AtomicU16::new(0)" ,
1923
1944
u16 AtomicU16 ATOMIC_U16_INIT
1924
1945
}
1925
1946
#[ cfg( target_has_atomic = "32" ) ]
@@ -1934,6 +1955,7 @@ atomic_int! {
1934
1955
"#![feature(integer_atomics)]\n \n " ,
1935
1956
atomic_min, atomic_max,
1936
1957
4 ,
1958
+ "AtomicI32::new(0)" ,
1937
1959
i32 AtomicI32 ATOMIC_I32_INIT
1938
1960
}
1939
1961
#[ cfg( target_has_atomic = "32" ) ]
@@ -1948,6 +1970,7 @@ atomic_int! {
1948
1970
"#![feature(integer_atomics)]\n \n " ,
1949
1971
atomic_umin, atomic_umax,
1950
1972
4 ,
1973
+ "AtomicU32::new(0)" ,
1951
1974
u32 AtomicU32 ATOMIC_U32_INIT
1952
1975
}
1953
1976
#[ cfg( target_has_atomic = "64" ) ]
@@ -1962,6 +1985,7 @@ atomic_int! {
1962
1985
"#![feature(integer_atomics)]\n \n " ,
1963
1986
atomic_min, atomic_max,
1964
1987
8 ,
1988
+ "AtomicI64::new(0)" ,
1965
1989
i64 AtomicI64 ATOMIC_I64_INIT
1966
1990
}
1967
1991
#[ cfg( target_has_atomic = "64" ) ]
@@ -1976,6 +2000,7 @@ atomic_int! {
1976
2000
"#![feature(integer_atomics)]\n \n " ,
1977
2001
atomic_umin, atomic_umax,
1978
2002
8 ,
2003
+ "AtomicU64::new(0)" ,
1979
2004
u64 AtomicU64 ATOMIC_U64_INIT
1980
2005
}
1981
2006
#[ cfg( target_has_atomic = "128" ) ]
@@ -1990,6 +2015,7 @@ atomic_int! {
1990
2015
"#![feature(integer_atomics)]\n \n " ,
1991
2016
atomic_min, atomic_max,
1992
2017
16 ,
2018
+ "AtomicI128::new(0)" ,
1993
2019
i128 AtomicI128 ATOMIC_I128_INIT
1994
2020
}
1995
2021
#[ cfg( target_has_atomic = "128" ) ]
@@ -2004,6 +2030,7 @@ atomic_int! {
2004
2030
"#![feature(integer_atomics)]\n \n " ,
2005
2031
atomic_umin, atomic_umax,
2006
2032
16 ,
2033
+ "AtomicU128::new(0)" ,
2007
2034
u128 AtomicU128 ATOMIC_U128_INIT
2008
2035
}
2009
2036
#[ cfg( target_pointer_width = "16" ) ]
@@ -2030,6 +2057,7 @@ atomic_int!{
2030
2057
"" ,
2031
2058
atomic_min, atomic_max,
2032
2059
ptr_width!( ) ,
2060
+ "AtomicIsize::new(0)" ,
2033
2061
isize AtomicIsize ATOMIC_ISIZE_INIT
2034
2062
}
2035
2063
#[ cfg( target_has_atomic = "ptr" ) ]
@@ -2044,6 +2072,7 @@ atomic_int!{
2044
2072
"" ,
2045
2073
atomic_umin, atomic_umax,
2046
2074
ptr_width!( ) ,
2075
+ "AtomicUsize::new(0)" ,
2047
2076
usize AtomicUsize ATOMIC_USIZE_INIT
2048
2077
}
2049
2078
0 commit comments