diff options
| author | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
|---|---|---|
| committer | Denys Zariaiev <denys.zariaiev@gmail.com> | 2019-03-13 21:00:45 +0100 |
| commit | eeb5f171da2486c34e4e473c97a1468279d05e7c (patch) | |
| tree | b452442f799d5d62141419e7091de13c212de9ff /src/libstd/sync | |
| parent | 5c7ec6c421af26666d3ec1c5fe022d099133951c (diff) | |
| parent | 8bf1f1c8f4100247c1f9b3d9b7aecea5c970263e (diff) | |
| download | rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.tar.gz rust-eeb5f171da2486c34e4e473c97a1468279d05e7c.zip | |
Merge remote-tracking branch 'upstream/master' into asm-compile-tests
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/barrier.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/condvar.rs | 26 | ||||
| -rw-r--r-- | src/libstd/sync/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/blocking.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/cache_aligned.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/mod.rs | 24 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/mpsc_queue.rs | 11 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/oneshot.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/select.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/select_tests.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/shared.rs | 20 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/spsc_queue.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/stream.rs | 19 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/sync.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 22 | ||||
| -rw-r--r-- | src/libstd/sync/once.rs | 16 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 22 |
17 files changed, 114 insertions, 114 deletions
diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index bc2e14d436a..a4205daba8b 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -1,5 +1,5 @@ -use fmt; -use sync::{Mutex, Condvar}; +use crate::fmt; +use crate::sync::{Mutex, Condvar}; /// A barrier enables multiple threads to synchronize the beginning /// of some computation. @@ -181,9 +181,9 @@ impl BarrierWaitResult { #[cfg(test)] mod tests { - use sync::{Arc, Barrier}; - use sync::mpsc::{channel, TryRecvError}; - use thread; + use crate::sync::{Arc, Barrier}; + use crate::sync::mpsc::{channel, TryRecvError}; + use crate::thread; #[test] #[cfg_attr(target_os = "emscripten", ignore)] diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 036aff090ea..5ebb61754e1 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -1,10 +1,10 @@ -use fmt; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::{mutex, MutexGuard, PoisonError}; -use sys_common::condvar as sys; -use sys_common::mutex as sys_mutex; -use sys_common::poison::{self, LockResult}; -use time::{Duration, Instant}; +use crate::fmt; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::{mutex, MutexGuard, PoisonError}; +use crate::sys_common::condvar as sys; +use crate::sys_common::mutex as sys_mutex; +use crate::sys_common::poison::{self, LockResult}; +use crate::time::{Duration, Instant}; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. @@ -612,12 +612,12 @@ impl Drop for Condvar { #[cfg(test)] mod tests { /// #![feature(wait_until)] - use sync::mpsc::channel; - use sync::{Condvar, Mutex, Arc}; - use sync::atomic::{AtomicBool, Ordering}; - use thread; - use time::Duration; - use u64; + use crate::sync::mpsc::channel; + use crate::sync::{Condvar, Mutex, Arc}; + use crate::sync::atomic::{AtomicBool, Ordering}; + use crate::thread; + use crate::time::Duration; + use crate::u64; #[test] fn smoke() { diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 3d11af7dc10..809ee882698 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -165,7 +165,7 @@ pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::once::{Once, OnceState, ONCE_INIT}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; +pub use crate::sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index eaf09a16756..6eacfaec253 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -1,10 +1,10 @@ //! Generic support for building blocking abstractions. -use thread::{self, Thread}; -use sync::atomic::{AtomicBool, Ordering}; -use sync::Arc; -use mem; -use time::Instant; +use crate::thread::{self, Thread}; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sync::Arc; +use crate::mem; +use crate::time::Instant; struct Inner { thread: Thread, diff --git a/src/libstd/sync/mpsc/cache_aligned.rs b/src/libstd/sync/mpsc/cache_aligned.rs index fb1177e0350..b14a9e5d61b 100644 --- a/src/libstd/sync/mpsc/cache_aligned.rs +++ b/src/libstd/sync/mpsc/cache_aligned.rs @@ -1,4 +1,4 @@ -use ops::{Deref, DerefMut}; +use crate::ops::{Deref, DerefMut}; #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(align(64))] diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 5273345c6b4..90c5c50c23b 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -266,12 +266,12 @@ // And now that you've seen all the races that I found and attempted to fix, // here's the code for you to find some more! -use sync::Arc; -use error; -use fmt; -use mem; -use cell::UnsafeCell; -use time::{Duration, Instant}; +use crate::sync::Arc; +use crate::error; +use crate::fmt; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::time::{Duration, Instant}; #[unstable(feature = "mpsc_select", issue = "27800")] pub use self::select::{Select, Handle}; @@ -1822,10 +1822,10 @@ impl From<RecvError> for RecvTimeoutError { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use env; use super::*; - use thread; - use time::{Duration, Instant}; + use crate::env; + use crate::thread; + use crate::time::{Duration, Instant}; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { @@ -2514,10 +2514,10 @@ mod tests { #[cfg(all(test, not(target_os = "emscripten")))] mod sync_tests { - use env; - use thread; use super::*; - use time::Duration; + use crate::env; + use crate::thread; + use crate::time::Duration; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 794d11f1eac..8f5681b97f4 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -15,8 +15,9 @@ pub use self::PopResult::*; use core::ptr; use core::cell::UnsafeCell; -use boxed::Box; -use sync::atomic::{AtomicPtr, Ordering}; + +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, Ordering}; /// A result of the `pop` function. pub enum PopResult<T> { @@ -120,10 +121,10 @@ impl<T> Drop for Queue<T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; use super::{Queue, Data, Empty, Inconsistent}; - use sync::Arc; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::Arc; + use crate::thread; #[test] fn test_full() { diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index 36928c428e3..5c516d5de0f 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -27,12 +27,12 @@ pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; -use sync::mpsc::Receiver; -use sync::mpsc::blocking::{self, SignalToken}; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, Ordering}; -use time::Instant; +use crate::sync::mpsc::Receiver; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::time::Instant; // Various states you can find a port in. const EMPTY: usize = 0; // initial state: no data, no blocked receiver diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 8591b55dc58..19c94908645 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -46,16 +46,14 @@ #![rustc_deprecated(since = "1.32.0", reason = "channel selection will be removed in a future release")] - -use fmt; - use core::cell::{Cell, UnsafeCell}; use core::marker; use core::ptr; use core::usize; -use sync::mpsc::{Receiver, RecvError}; -use sync::mpsc::blocking::{self, SignalToken}; +use crate::fmt; +use crate::sync::mpsc::{Receiver, RecvError}; +use crate::sync::mpsc::blocking::{self, SignalToken}; /// The "receiver set" of the select interface. This structure is used to manage /// a set of receivers which are being selected over. diff --git a/src/libstd/sync/mpsc/select_tests.rs b/src/libstd/sync/mpsc/select_tests.rs index be048511caa..18d93462c78 100644 --- a/src/libstd/sync/mpsc/select_tests.rs +++ b/src/libstd/sync/mpsc/select_tests.rs @@ -2,8 +2,8 @@ /// This file exists to hack around https://github.com/rust-lang/rust/issues/47238 -use thread; -use sync::mpsc::*; +use crate::thread; +use crate::sync::mpsc::*; // Don't use the libstd version so we can pull in the right Select structure // (std::comm points at the wrong one) diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 3da73ac0b82..6a5d861f0e9 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -14,16 +14,16 @@ use core::cmp; use core::intrinsics::abort; use core::isize; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; -use sync::mpsc::blocking::{self, SignalToken}; -use sync::mpsc::mpsc_queue as mpsc; -use sync::mpsc::select::StartResult::*; -use sync::mpsc::select::StartResult; -use sync::{Mutex, MutexGuard}; -use thread; -use time::Instant; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::sync::mpsc::mpsc_queue as mpsc; +use crate::sync::mpsc::select::StartResult::*; +use crate::sync::mpsc::select::StartResult; +use crate::sync::{Mutex, MutexGuard}; +use crate::thread; +use crate::time::Instant; const DISCONNECTED: isize = isize::MIN; const FUDGE: isize = 1024; diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index b43ccf074a4..0edb1c24e80 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -6,11 +6,11 @@ // http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue -use boxed::Box; use core::ptr; use core::cell::UnsafeCell; -use sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use super::cache_aligned::CacheAligned; @@ -233,10 +233,10 @@ impl<T, ProducerAddition, ConsumerAddition> Drop for Queue<T, ProducerAddition, #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::Arc; use super::Queue; - use thread; - use sync::mpsc::channel; + use crate::sync::Arc; + use crate::thread; + use crate::sync::mpsc::channel; #[test] fn smoke() { diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index 5c68930bf47..7ae6f68b514 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -12,17 +12,18 @@ pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::Message::*; -use cell::UnsafeCell; use core::cmp; use core::isize; -use ptr; -use thread; -use time::Instant; - -use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool}; -use sync::mpsc::Receiver; -use sync::mpsc::blocking::{self, SignalToken}; -use sync::mpsc::spsc_queue as spsc; + +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::thread; +use crate::time::Instant; + +use crate::sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool}; +use crate::sync::mpsc::Receiver; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::sync::mpsc::spsc_queue as spsc; const DISCONNECTED: isize = isize::MIN; #[cfg(test)] diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index bce42bc69cd..485234a9495 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -31,11 +31,11 @@ use core::isize; use core::mem; use core::ptr; -use sync::atomic::{Ordering, AtomicUsize}; -use sync::mpsc::blocking::{self, WaitToken, SignalToken}; -use sync::mpsc::select::StartResult::{self, Installed, Abort}; -use sync::{Mutex, MutexGuard}; -use time::Instant; +use crate::sync::atomic::{Ordering, AtomicUsize}; +use crate::sync::mpsc::blocking::{self, WaitToken, SignalToken}; +use crate::sync::mpsc::select::StartResult::{self, Installed, Abort}; +use crate::sync::{Mutex, MutexGuard}; +use crate::time::Instant; const MAX_REFCOUNT: usize = (isize::MAX) as usize; diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 954867911a0..6b812e65b72 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use fmt; -use mem; -use ops::{Deref, DerefMut}; -use ptr; -use sys_common::mutex as sys; -use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::mem; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys_common::mutex as sys; +use crate::sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// A mutual exclusion primitive useful for protecting shared data /// @@ -471,10 +471,10 @@ pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Fla #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; - use sync::{Arc, Mutex, Condvar}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::{Arc, Mutex, Condvar}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; struct Packet<T>(Arc<(Mutex<T>, Condvar)>); diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index e207d0170d7..a036c266662 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -52,11 +52,11 @@ // You'll find a few more details in the implementation, but that's the gist of // it! -use fmt; -use marker; -use ptr; -use sync::atomic::{AtomicUsize, AtomicBool, Ordering}; -use thread::{self, Thread}; +use crate::fmt; +use crate::marker; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; +use crate::thread::{self, Thread}; /// A synchronization primitive which can be used to run a one-time global /// initialization. Useful for one-time initialization for FFI or related @@ -514,9 +514,9 @@ impl OnceState { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use panic; - use sync::mpsc::channel; - use thread; + use crate::panic; + use crate::sync::mpsc::channel; + use crate::thread; use super::Once; #[test] diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 7f3cb4f72c7..0be83c76d62 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use fmt; -use mem; -use ops::{Deref, DerefMut}; -use ptr; -use sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; -use sys_common::rwlock as sys; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::mem; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; +use crate::sys_common::rwlock as sys; /// A reader-writer lock /// @@ -554,10 +554,10 @@ impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { use rand::{self, Rng}; - use sync::mpsc::channel; - use thread; - use sync::{Arc, RwLock, TryLockError}; - use sync::atomic::{AtomicUsize, Ordering}; + use crate::sync::mpsc::channel; + use crate::thread; + use crate::sync::{Arc, RwLock, TryLockError}; + use crate::sync::atomic::{AtomicUsize, Ordering}; #[derive(Eq, PartialEq, Debug)] struct NonCopy(i32); |
