]> git.lizzy.rs Git - rust.git/commitdiff
Replace deprecated ATOMIC_INIT consts
authorMark Rousskov <mark.simulacrum@gmail.com>
Sat, 26 Jan 2019 16:14:49 +0000 (09:14 -0700)
committerMark Rousskov <mark.simulacrum@gmail.com>
Sat, 26 Jan 2019 22:27:38 +0000 (15:27 -0700)
27 files changed:
src/liballoc/tests/binary_heap.rs
src/liballoc/tests/slice.rs
src/libcore/sync/atomic.rs
src/librustc_driver/lib.rs
src/librustc_mir/diagnostics.rs
src/libstd/alloc.rs
src/libstd/sys/redox/thread_local.rs
src/libstd/sys/sgx/abi/tls.rs
src/libstd/sys/unix/pipe.rs
src/libstd/sys/windows/pipe.rs
src/test/run-pass/allocator/auxiliary/custom-as-global.rs
src/test/run-pass/allocator/custom.rs
src/test/run-pass/allocator/xcrate-use.rs
src/test/run-pass/allocator/xcrate-use2.rs
src/test/run-pass/atomic-access-bool.rs
src/test/run-pass/atomic-compare_exchange.rs
src/test/run-pass/deriving/deriving-copyclone.rs
src/test/run-pass/generator/conditional-drop.rs
src/test/run-pass/generator/drop-env.rs
src/test/run-pass/generator/panic-drops.rs
src/test/run-pass/issues/issue-34053.rs
src/test/run-pass/mir/mir_fat_ptr_drop.rs
src/test/run-pass/panics/panic-recover-propagate.rs
src/test/run-pass/threads-sendsync/tls-init-on-init.rs
src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs
src/test/ui/error-codes/E0492.rs
src/tools/remote-test-server/src/main.rs

index 6af1cf4080947fa83dadd724fc26b6988dc5e7ba..94ae43237d19c3309d732cecfc756f747888e6ea 100644 (file)
@@ -2,7 +2,7 @@
 use std::collections::BinaryHeap;
 use std::collections::binary_heap::{Drain, PeekMut};
 use std::panic::{self, AssertUnwindSafe};
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
 use rand::{thread_rng, seq::SliceRandom};
 
@@ -283,7 +283,7 @@ fn drain<'new>(d: Drain<'static, &'static str>) -> Drain<'new, &'new str> {
 // Destructors must be called exactly once per element.
 #[test]
 fn panic_safe() {
-    static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
+    static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
 
     #[derive(Eq, PartialEq, Ord, Clone, Debug)]
     struct PanicOrd<T>(T, bool);
index 8ecd17236c048ec8e400031593451a0645fa3cd5..0300bd7f3f6d4bb1f7ac0ba58ae66c797a8557cb 100644 (file)
@@ -5,7 +5,7 @@
 use std::panic;
 use std::rc::Rc;
 use std::sync::atomic::Ordering::Relaxed;
-use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize};
+use std::sync::atomic::AtomicUsize;
 use std::thread;
 
 use rand::{Rng, RngCore, thread_rng, seq::SliceRandom};
@@ -1500,7 +1500,7 @@ fn test_copy_from_slice_dst_shorter() {
     AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
 ];
 
-static VERSIONS: AtomicUsize = ATOMIC_USIZE_INIT;
+static VERSIONS: AtomicUsize = AtomicUsize::new(0);
 
 #[derive(Clone, Eq)]
 struct DropCounter {
index b9ebf19b23cab36c1fde5299d1dcbeab7f282fe6..bcedff5abc70c0aba73f766ea5088369e55a7c97 100644 (file)
@@ -2413,12 +2413,11 @@ pub fn fence(order: Ordering) {
 ///
 /// ```
 /// use std::sync::atomic::{AtomicBool, AtomicUsize};
-/// use std::sync::atomic::{ATOMIC_BOOL_INIT, ATOMIC_USIZE_INIT};
 /// use std::sync::atomic::Ordering;
 /// use std::sync::atomic::compiler_fence;
 ///
-/// static IMPORTANT_VARIABLE: AtomicUsize = ATOMIC_USIZE_INIT;
-/// static IS_READY: AtomicBool = ATOMIC_BOOL_INIT;
+/// static IMPORTANT_VARIABLE: AtomicUsize = AtomicUsize::new(0);
+/// static IS_READY: AtomicBool = AtomicBool::new(false);
 ///
 /// fn main() {
 ///     IMPORTANT_VARIABLE.store(42, Ordering::Relaxed);
index abcdf175ada996c73e3175480d36c20f38b78f41..a95ce810ffaeba4af138c518fa3495677b6d8c4f 100644 (file)
@@ -91,7 +91,7 @@
 use std::path::{PathBuf, Path};
 use std::process::{self, Command, Stdio};
 use std::str;
-use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
+use std::sync::atomic::{AtomicBool, Ordering};
 use std::sync::{Once, ONCE_INIT};
 use std::thread;
 
@@ -254,7 +254,7 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend> {
     // general this assertion never trips due to the once guard in `get_codegen_backend`,
     // but there's a few manual calls to this function in this file we protect
     // against.
-    static LOADED: AtomicBool = ATOMIC_BOOL_INIT;
+    static LOADED: AtomicBool = AtomicBool::new(false);
     assert!(!LOADED.fetch_or(true, Ordering::SeqCst),
             "cannot load the default codegen backend twice");
 
index ea9e19c75c215473058f94a889116a58cd4c4253..74394165a5f84c9e7c55a6eaa0652b6c4fcbfd58 100644 (file)
@@ -1127,9 +1127,9 @@ fn main() {
 code example:
 
 ```compile_fail,E0492
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
+use std::sync::atomic::AtomicUsize;
 
-const A: AtomicUsize = ATOMIC_USIZE_INIT;
+const A: AtomicUsize = AtomicUsize::new(0);
 static B: &'static AtomicUsize = &A;
 // error: cannot borrow a constant which may contain interior mutability,
 //        create a static instead
@@ -1145,9 +1145,9 @@ fn main() {
 So, in order to solve this error, either use statics which are `Sync`:
 
 ```
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
+use std::sync::atomic::AtomicUsize;
 
-static A: AtomicUsize = ATOMIC_USIZE_INIT;
+static A: AtomicUsize = AtomicUsize::new(0);
 static B: &'static AtomicUsize = &A; // ok!
 ```
 
index 537f56a8da71dda5b9036516aa7bffdd84a6ee6b..8b6e5680c2d6c324159678da3e4da9b057243273 100644 (file)
 ///
 /// ```rust
 /// use std::alloc::{System, GlobalAlloc, Layout};
-/// use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering::SeqCst};
+/// use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
 ///
 /// struct Counter;
 ///
-/// static ALLOCATED: AtomicUsize = ATOMIC_USIZE_INIT;
+/// static ALLOCATED: AtomicUsize = AtomicUsize::new(0);
 ///
 /// unsafe impl GlobalAlloc for Counter {
 ///     unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
index a1c4b10e450635b57fb92c81d97f814eaa84c3ad..a1929b941659d9c0d9b005f5f1f8e9f2d4f8af75 100644 (file)
@@ -2,13 +2,13 @@
 
 use collections::BTreeMap;
 use ptr;
-use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use sync::atomic::{AtomicUsize, Ordering};
 
 pub type Key = usize;
 
 type Dtor = unsafe extern fn(*mut u8);
 
-static NEXT_KEY: AtomicUsize = ATOMIC_USIZE_INIT;
+static NEXT_KEY: AtomicUsize = AtomicUsize::new(0);
 
 static mut KEYS: *mut BTreeMap<Key, Option<Dtor>> = ptr::null_mut();
 
index aba93db915fe8ea4316c5b4dca0b817035661336..b8e09d58debaddb4b4c99971092f83c47216d275 100644 (file)
@@ -1,4 +1,4 @@
-use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use sync::atomic::{AtomicUsize, Ordering};
 use ptr;
 use mem;
 use cell::Cell;
@@ -15,7 +15,40 @@ macro_rules! dup {
     ((* $($exp:tt)*) $($val:tt)*) => (dup!( ($($exp)*) $($val)* $($val)* ));
     (() $($val:tt)*) => ([$($val),*])
 }
-static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = dup!((* * * * * * *) ATOMIC_USIZE_INIT);
+static TLS_DESTRUCTOR: [AtomicUsize; TLS_KEYS] = [
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+    AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0),
+];
 
 extern "C" {
     fn get_tls_ptr() -> *const u8;
@@ -119,7 +152,7 @@ pub fn destroy(key: Key) {
 }
 
 mod sync_bitset {
-    use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+    use sync::atomic::{AtomicUsize, Ordering};
     use iter::{Enumerate, Peekable};
     use slice::Iter;
     use super::{TLS_KEYS_BITSET_SIZE, USIZE_BITS};
@@ -128,7 +161,7 @@ mod sync_bitset {
     pub(super) struct SyncBitset([AtomicUsize; TLS_KEYS_BITSET_SIZE]);
 
     pub(super) const SYNC_BITSET_INIT: SyncBitset =
-        SyncBitset([ATOMIC_USIZE_INIT, ATOMIC_USIZE_INIT]);
+        SyncBitset([AtomicUsize::new(0), AtomicUsize::new(0)]);
 
     impl SyncBitset {
         pub fn get(&self, index: usize) -> bool {
index 91793a0d5ec3f587a9556dbf8e315aa17de6d68b..a746d982c6ca9d4db144d9ab20de5c0ba2cb083a 100644 (file)
@@ -1,7 +1,7 @@
 use io;
 use libc::{self, c_int};
 use mem;
-use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
+use sync::atomic::{AtomicBool, Ordering};
 use sys::fd::FileDesc;
 use sys::{cvt, cvt_r};
 
@@ -13,7 +13,7 @@
 
 pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> {
     syscall! { fn pipe2(fds: *mut c_int, flags: c_int) -> c_int }
-    static INVALID: AtomicBool = ATOMIC_BOOL_INIT;
+    static INVALID: AtomicBool = AtomicBool::new(false);
 
     let mut fds = [0; 2];
 
index 2b1dbe310eea4575afb0565a4a830f5e891f75d8..0d9195a5c971672b9f4007ab2defd67c46a8bf3f 100644 (file)
@@ -7,7 +7,7 @@
 use ptr;
 use slice;
 use sync::atomic::Ordering::SeqCst;
-use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
+use sync::atomic::AtomicUsize;
 use sys::c;
 use sys::fs::{File, OpenOptions};
 use sys::handle::Handle;
@@ -148,7 +148,7 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result<Pipes> {
 }
 
 fn random_number() -> usize {
-    static N: AtomicUsize = ATOMIC_USIZE_INIT;
+    static N: AtomicUsize = AtomicUsize::new(0);
     loop {
         if N.load(SeqCst) != 0 {
             return N.fetch_add(1, SeqCst)
index 6842e2c33b217d6790fa6f3cb2bd15d3c7762191..a5e96e7750184a5e1e4bd0e3dd6891f858ae2db0 100644 (file)
@@ -4,12 +4,12 @@
 
 extern crate custom;
 
-use std::sync::atomic::{ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
 use custom::A;
 
 #[global_allocator]
-static ALLOCATOR: A = A(ATOMIC_USIZE_INIT);
+static ALLOCATOR: A = A(AtomicUsize::new(0));
 
 pub fn get() -> usize {
     ALLOCATOR.0.load(Ordering::SeqCst)
index a8c6e0325e1267c3018335f4635508421e801748..71f72ae46c23f26a673a4ae5cf5840c2bdd2a57a 100644 (file)
@@ -8,9 +8,9 @@
 extern crate helper;
 
 use std::alloc::{self, Global, Alloc, System, Layout};
-use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static HITS: AtomicUsize = ATOMIC_USIZE_INIT;
+static HITS: AtomicUsize = AtomicUsize::new(0);
 
 struct A;
 
index eb911a62e91cba1e3e72cf0768f1f3819d1a170b..039c70e77bedfb10beea0bf3dbb9c0287237c8ee 100644 (file)
 extern crate helper;
 
 use std::alloc::{Global, Alloc, System, Layout};
-use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{Ordering, AtomicUsize};
 
 #[global_allocator]
-static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT);
+static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
 
 fn main() {
     unsafe {
index be657f127bbc259e98c016ab54abf69854525200..d8478fb5eaa41960bf1551ab34dfbfb2e8f847a4 100644 (file)
@@ -12,9 +12,9 @@
 extern crate helper;
 
 use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout};
-use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT);
+static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
 
 fn main() {
     unsafe {
@@ -45,4 +45,3 @@ fn main() {
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2);
     }
 }
-
index 4f804bcdef235be491390aa0085b6a98a38fa1d9..8522493232f98dcad580658a7d1238953413cd7d 100644 (file)
@@ -1,9 +1,9 @@
 #![allow(stable_features)]
 #![feature(atomic_access)]
-use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
+use std::sync::atomic::AtomicBool;
 use std::sync::atomic::Ordering::*;
 
-static mut ATOMIC: AtomicBool = ATOMIC_BOOL_INIT;
+static mut ATOMIC: AtomicBool = AtomicBool::new(false);
 
 fn main() {
     unsafe {
index c7b80c42c1baa657e4f99df074114b163190f538..77da820e07c56c2dfd3c6b8869d46d2deb6d80f9 100644 (file)
@@ -1,10 +1,10 @@
 #![allow(stable_features)]
 
 #![feature(extended_compare_and_swap)]
-use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT};
+use std::sync::atomic::AtomicIsize;
 use std::sync::atomic::Ordering::*;
 
-static ATOMIC: AtomicIsize = ATOMIC_ISIZE_INIT;
+static ATOMIC: AtomicIsize = AtomicIsize::new(0);
 
 fn main() {
     // Make sure codegen can emit all the intrinsics correctly
index cdeb5d03d35c6269403c0ce12bff908538469d17..78d74a11ffc8b4e96fd19d75ed87664b20e2ccf2 100644 (file)
@@ -2,7 +2,7 @@
 //! Test that #[derive(Copy, Clone)] produces a shallow copy
 //! even when a member violates RFC 1521
 
-use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering};
+use std::sync::atomic::{AtomicBool, Ordering};
 
 /// A struct that pretends to be Copy, but actually does something
 /// in its Clone impl
@@ -10,7 +10,7 @@
 struct Liar;
 
 /// Static cooperating with the rogue Clone impl
-static CLONED: AtomicBool = ATOMIC_BOOL_INIT;
+static CLONED: AtomicBool = AtomicBool::new(false);
 
 impl Clone for Liar {
     fn clone(&self) -> Self {
@@ -36,4 +36,3 @@ fn main() {
     // if Innocent was byte-for-byte copied, CLONED will still be false
     assert!(!CLONED.load(Ordering::SeqCst));
 }
-
index b7d7681d25c9e8196c70e4ce3dd8afdfe345e473..766eef9e3f3c34525a7a420839466934ab13e1be 100644 (file)
@@ -3,9 +3,9 @@
 #![feature(generators, generator_trait)]
 
 use std::ops::Generator;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static A: AtomicUsize = ATOMIC_USIZE_INIT;
+static A: AtomicUsize = AtomicUsize::new(0);
 
 struct B;
 
index bd988897710f7406ddee783cbaa470b350c756bb..252f2c0f07da70deb3274fec2635be1a329e48df 100644 (file)
@@ -3,9 +3,9 @@
 #![feature(generators, generator_trait)]
 
 use std::ops::Generator;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static A: AtomicUsize = ATOMIC_USIZE_INIT;
+static A: AtomicUsize = AtomicUsize::new(0);
 
 struct B;
 
index ce12f4225ef0a0a16c8ec4ed287075c4d133cc21..8640a6539195b27b52f1557b070fc13a7adc8b61 100644 (file)
@@ -6,9 +6,9 @@
 
 use std::ops::Generator;
 use std::panic;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static A: AtomicUsize = ATOMIC_USIZE_INIT;
+static A: AtomicUsize = AtomicUsize::new(0);
 
 struct B;
 
index ec5a0cbf6bbd543f2f02e31881eacf71386b2e17..fa23ae8f95bee94fc6e37f4b2842e6b5a0e93ba1 100644 (file)
@@ -1,7 +1,7 @@
 // run-pass
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
-static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
+static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0);
 
 struct A(i32);
 
index 9f4f3d6c5d306981f01785274f0c7b4a7c1d49b4..d865c3499b2703dac6e770424309c3077c314e18 100644 (file)
@@ -10,7 +10,7 @@
 use std::sync::atomic;
 use std::sync::atomic::Ordering::SeqCst;
 
-static COUNTER: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
+static COUNTER: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
 
 struct DropMe {
 }
index 0a15417f72a4e808379388d29e039b49c1431b9c..7969336ca749bacf1e97ba991de8940fa26d44b1 100644 (file)
@@ -1,11 +1,11 @@
 // run-pass
 // ignore-emscripten no threads support
 
-use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use std::panic;
 use std::thread;
 
-static A: AtomicUsize = ATOMIC_USIZE_INIT;
+static A: AtomicUsize = AtomicUsize::new(0);
 
 fn main() {
     panic::set_hook(Box::new(|_| {
index 6ac7a9253cdd3cc16b0f351e281f443be92d5c13..193c18151059a0a357cdcf401f8cfa4e948e38bc 100644 (file)
@@ -6,13 +6,13 @@
 #![feature(thread_local_try_with)]
 
 use std::thread;
-use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
+use std::sync::atomic::{AtomicUsize, Ordering};
 
 struct Foo { cnt: usize }
 
 thread_local!(static FOO: Foo = Foo::init());
 
-static CNT: AtomicUsize = ATOMIC_USIZE_INIT;
+static CNT: AtomicUsize = AtomicUsize::new(0);
 
 impl Foo {
     fn init() -> Foo {
index 670c6bb869d59962ffbc78cbda8efc2854fea41f..7477947b89ca4b9794a1243351e69a7026deeb77 100644 (file)
@@ -10,7 +10,7 @@
 #![feature(thread_local)]
 
 #[thread_local]
-static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT;
+static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0);
 
 fn main() {
     unsafe {
index b1824941adf0000065c3c01279b241a1bc8da217..2de4c12eb64fbef3547c5a04c9a3198dac872b98 100644 (file)
@@ -1,6 +1,6 @@
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT};
+use std::sync::atomic::AtomicUsize;
 
-const A: AtomicUsize = ATOMIC_USIZE_INIT;
+const A: AtomicUsize = AtomicUsize::new(0);
 static B: &'static AtomicUsize = &A; //~ ERROR E0492
 
 fn main() {
index 74dde8bf0e2c907fc26b3afb6501175cb2c34734..3f56d4da6a3ed588392b744ac8cbc87314ab1df8 100644 (file)
@@ -20,7 +20,7 @@
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::str;
-use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
+use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::{Arc, Mutex};
 use std::thread;
 
@@ -31,7 +31,7 @@ macro_rules! t {
     })
 }
 
-static TEST: AtomicUsize = ATOMIC_USIZE_INIT;
+static TEST: AtomicUsize = AtomicUsize::new(0);
 
 struct Config {
     pub remote: bool,