@@ -290,7 +290,15 @@ pub enum Ordering {
290290/// [`AtomicBool`]: struct.AtomicBool.html
291291#[ cfg( target_has_atomic = "8" ) ]
292292#[ 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+ ) ) ]
294302pub const ATOMIC_BOOL_INIT : AtomicBool = AtomicBool :: new ( false ) ;
295303
296304#[ cfg( target_has_atomic = "8" ) ]
@@ -1127,6 +1135,7 @@ macro_rules! atomic_int {
11271135 $extra_feature: expr,
11281136 $min_fn: ident, $max_fn: ident,
11291137 $align: expr,
1138+ $atomic_new: expr,
11301139 $int_type: ident $atomic_type: ident $atomic_init: ident) => {
11311140 /// An integer type which can be safely shared between threads.
11321141 ///
@@ -1148,7 +1157,15 @@ macro_rules! atomic_int {
11481157
11491158 /// An atomic integer initialized to `0`.
11501159 #[ $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+ ) ) ]
11521169 pub const $atomic_init: $atomic_type = $atomic_type:: new( 0 ) ;
11531170
11541171 #[ $stable]
@@ -1878,6 +1895,7 @@ atomic_int! {
18781895 "#![feature(integer_atomics)]\n \n " ,
18791896 atomic_min, atomic_max,
18801897 1 ,
1898+ "AtomicI8::new(0)" ,
18811899 i8 AtomicI8 ATOMIC_I8_INIT
18821900}
18831901#[ cfg( target_has_atomic = "8" ) ]
@@ -1892,6 +1910,7 @@ atomic_int! {
18921910 "#![feature(integer_atomics)]\n \n " ,
18931911 atomic_umin, atomic_umax,
18941912 1 ,
1913+ "AtomicU8::new(0)" ,
18951914 u8 AtomicU8 ATOMIC_U8_INIT
18961915}
18971916#[ cfg( target_has_atomic = "16" ) ]
@@ -1906,6 +1925,7 @@ atomic_int! {
19061925 "#![feature(integer_atomics)]\n \n " ,
19071926 atomic_min, atomic_max,
19081927 2 ,
1928+ "AtomicI16::new(0)" ,
19091929 i16 AtomicI16 ATOMIC_I16_INIT
19101930}
19111931#[ cfg( target_has_atomic = "16" ) ]
@@ -1920,6 +1940,7 @@ atomic_int! {
19201940 "#![feature(integer_atomics)]\n \n " ,
19211941 atomic_umin, atomic_umax,
19221942 2 ,
1943+ "AtomicU16::new(0)" ,
19231944 u16 AtomicU16 ATOMIC_U16_INIT
19241945}
19251946#[ cfg( target_has_atomic = "32" ) ]
@@ -1934,6 +1955,7 @@ atomic_int! {
19341955 "#![feature(integer_atomics)]\n \n " ,
19351956 atomic_min, atomic_max,
19361957 4 ,
1958+ "AtomicI32::new(0)" ,
19371959 i32 AtomicI32 ATOMIC_I32_INIT
19381960}
19391961#[ cfg( target_has_atomic = "32" ) ]
@@ -1948,6 +1970,7 @@ atomic_int! {
19481970 "#![feature(integer_atomics)]\n \n " ,
19491971 atomic_umin, atomic_umax,
19501972 4 ,
1973+ "AtomicU32::new(0)" ,
19511974 u32 AtomicU32 ATOMIC_U32_INIT
19521975}
19531976#[ cfg( target_has_atomic = "64" ) ]
@@ -1962,6 +1985,7 @@ atomic_int! {
19621985 "#![feature(integer_atomics)]\n \n " ,
19631986 atomic_min, atomic_max,
19641987 8 ,
1988+ "AtomicI64::new(0)" ,
19651989 i64 AtomicI64 ATOMIC_I64_INIT
19661990}
19671991#[ cfg( target_has_atomic = "64" ) ]
@@ -1976,6 +2000,7 @@ atomic_int! {
19762000 "#![feature(integer_atomics)]\n \n " ,
19772001 atomic_umin, atomic_umax,
19782002 8 ,
2003+ "AtomicU64::new(0)" ,
19792004 u64 AtomicU64 ATOMIC_U64_INIT
19802005}
19812006#[ cfg( target_has_atomic = "128" ) ]
@@ -1990,6 +2015,7 @@ atomic_int! {
19902015 "#![feature(integer_atomics)]\n \n " ,
19912016 atomic_min, atomic_max,
19922017 16 ,
2018+ "AtomicI128::new(0)" ,
19932019 i128 AtomicI128 ATOMIC_I128_INIT
19942020}
19952021#[ cfg( target_has_atomic = "128" ) ]
@@ -2004,6 +2030,7 @@ atomic_int! {
20042030 "#![feature(integer_atomics)]\n \n " ,
20052031 atomic_umin, atomic_umax,
20062032 16 ,
2033+ "AtomicU128::new(0)" ,
20072034 u128 AtomicU128 ATOMIC_U128_INIT
20082035}
20092036#[ cfg( target_pointer_width = "16" ) ]
@@ -2030,6 +2057,7 @@ atomic_int!{
20302057 "" ,
20312058 atomic_min, atomic_max,
20322059 ptr_width!( ) ,
2060+ "AtomicIsize::new(0)" ,
20332061 isize AtomicIsize ATOMIC_ISIZE_INIT
20342062}
20352063#[ cfg( target_has_atomic = "ptr" ) ]
@@ -2044,6 +2072,7 @@ atomic_int!{
20442072 "" ,
20452073 atomic_umin, atomic_umax,
20462074 ptr_width!( ) ,
2075+ "AtomicUsize::new(0)" ,
20472076 usize AtomicUsize ATOMIC_USIZE_INIT
20482077}
20492078
0 commit comments