diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 3410976a6e4..0e2b0a441e6 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -21,7 +21,7 @@ pub use alloc::arc::{Arc, Weak}; pub use self::mutex::{Mutex, MutexGuard, StaticMutex}; pub use self::mutex::MUTEX_INIT; -pub use self::rwlock::{RwLock, StaticRWLock, RWLOCK_INIT}; +pub use self::rwlock::{RwLock, StaticRwLock, RWLOCK_INIT}; pub use self::rwlock::{RWLockReadGuard, RWLockWriteGuard}; pub use self::condvar::{Condvar, StaticCondvar, CONDVAR_INIT}; pub use self::once::{Once, ONCE_INIT}; diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 5743386e055..04efbf893ea 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -60,7 +60,7 @@ use sys_common::rwlock as sys; /// ``` #[stable] pub struct RwLock { - inner: Box, + inner: Box, data: UnsafeCell, } @@ -76,9 +76,9 @@ unsafe impl Sync for RwLock {} /// # Example /// /// ``` -/// use std::sync::{StaticRWLock, RWLOCK_INIT}; +/// use std::sync::{StaticRwLock, RWLOCK_INIT}; /// -/// static LOCK: StaticRWLock = RWLOCK_INIT; +/// static LOCK: StaticRwLock = RWLOCK_INIT; /// /// { /// let _g = LOCK.read().unwrap(); @@ -101,7 +101,7 @@ unsafe impl Sync for StaticRwLock {} /// Constant initialization for a statically-initialized rwlock. #[unstable = "may be merged with RwLock in the future"] -pub const RWLOCK_INIT: StaticRWLock = StaticRWLock { +pub const RWLOCK_INIT: StaticRwLock = StaticRwLock { lock: sys::RWLOCK_INIT, poison: poison::FLAG_INIT, }; @@ -111,7 +111,7 @@ pub const RWLOCK_INIT: StaticRWLock = StaticRWLock { #[must_use] #[stable] pub struct RWLockReadGuard<'a, T: 'a> { - __lock: &'a StaticRWLock, + __lock: &'a StaticRwLock, __data: &'a UnsafeCell, __marker: marker::NoSend, } @@ -121,7 +121,7 @@ pub struct RWLockReadGuard<'a, T: 'a> { #[must_use] #[stable] pub struct RWLockWriteGuard<'a, T: 'a> { - __lock: &'a StaticRWLock, + __lock: &'a StaticRwLock, __data: &'a UnsafeCell, __poison: poison::Guard, __marker: marker::NoSend, @@ -302,7 +302,7 @@ impl StaticRwLock { } impl<'rwlock, T> RWLockReadGuard<'rwlock, T> { - fn new(lock: &'rwlock StaticRWLock, data: &'rwlock UnsafeCell) + fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell) -> LockResult> { poison::map_result(lock.poison.borrow(), |_| { RWLockReadGuard { @@ -314,7 +314,7 @@ impl<'rwlock, T> RWLockReadGuard<'rwlock, T> { } } impl<'rwlock, T> RWLockWriteGuard<'rwlock, T> { - fn new(lock: &'rwlock StaticRWLock, data: &'rwlock UnsafeCell) + fn new(lock: &'rwlock StaticRwLock, data: &'rwlock UnsafeCell) -> LockResult> { poison::map_result(lock.poison.borrow(), |guard| { RWLockWriteGuard { @@ -365,7 +365,7 @@ mod tests { use rand::{mod, Rng}; use sync::mpsc::channel; use thread::Thread; - use sync::{Arc, RwLock, StaticRWLock, RWLOCK_INIT}; + use sync::{Arc, RwLock, StaticRwLock, RWLOCK_INIT}; #[test] fn smoke() { @@ -378,7 +378,7 @@ mod tests { #[test] fn static_smoke() { - static R: StaticRWLock = RWLOCK_INIT; + static R: StaticRwLock = RWLOCK_INIT; drop(R.read().unwrap()); drop(R.write().unwrap()); drop((R.read().unwrap(), R.read().unwrap())); @@ -388,7 +388,7 @@ mod tests { #[test] fn frob() { - static R: StaticRWLock = RWLOCK_INIT; + static R: StaticRwLock = RWLOCK_INIT; static N: uint = 10; static M: uint = 1000;