diff options
| author | bors <bors@rust-lang.org> | 2019-12-06 23:35:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-06 23:35:00 +0000 |
| commit | 41601a8c95240cada94c13466a1fea02e5fe87ed (patch) | |
| tree | 703464bdb077746244b9d553579c48b9cbbedc70 /src/libstd/sync | |
| parent | ae1b871cca56613b1af1a5121dd24ac810ff4b89 (diff) | |
| parent | dbc9f306b69153cdff991303c1dfd7a29136b752 (diff) | |
| download | rust-41601a8c95240cada94c13466a1fea02e5fe87ed.tar.gz rust-41601a8c95240cada94c13466a1fea02e5fe87ed.zip | |
Auto merge of #67104 - Centril:rollup-07vahh9, r=Centril
Rollup of 10 pull requests
Successful merges:
- #66606 (Add feature gate for mut refs in const fn)
- #66841 (Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods)
- #67009 (Emit coercion suggestions in more places)
- #67052 (Ditch `parse_in_attr`)
- #67071 (Do not ICE on closure typeck)
- #67078 (accept union inside enum if not followed by identifier)
- #67090 (Change "either" to "any" in Layout::from_size_align's docs)
- #67092 (Fix comment typos in src/libcore/alloc.rs)
- #67094 (get rid of __ in field names)
- #67102 (Add note to src/ci/docker/README.md about multiple docker images)
Failed merges:
- #67101 (use `#[allow(unused_attributes)]` to paper over incr.comp problem)
r? @ghost
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mutex.rs | 22 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 28 |
2 files changed, 24 insertions, 26 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 87c2318a937..e90da699060 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -143,10 +143,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { } #[must_use = "if unused the Mutex will immediately unlock"] #[stable(feature = "rust1", since = "1.0.0")] pub struct MutexGuard<'a, T: ?Sized + 'a> { - // funny underscores due to how Deref/DerefMut currently work (they - // disregard field privacy). - __lock: &'a Mutex<T>, - __poison: poison::Guard, + lock: &'a Mutex<T>, + poison: poison::Guard, } #[stable(feature = "rust1", since = "1.0.0")] @@ -417,8 +415,8 @@ impl<'mutex, T: ?Sized> MutexGuard<'mutex, T> { unsafe fn new(lock: &'mutex Mutex<T>) -> LockResult<MutexGuard<'mutex, T>> { poison::map_result(lock.poison.borrow(), |guard| { MutexGuard { - __lock: lock, - __poison: guard, + lock: lock, + poison: guard, } }) } @@ -429,14 +427,14 @@ impl<T: ?Sized> Deref for MutexGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - unsafe { &*self.__lock.data.get() } + unsafe { &*self.lock.data.get() } } } #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> DerefMut for MutexGuard<'_, T> { fn deref_mut(&mut self) -> &mut T { - unsafe { &mut *self.__lock.data.get() } + unsafe { &mut *self.lock.data.get() } } } @@ -445,8 +443,8 @@ impl<T: ?Sized> Drop for MutexGuard<'_, T> { #[inline] fn drop(&mut self) { unsafe { - self.__lock.poison.done(&self.__poison); - self.__lock.inner.raw_unlock(); + self.lock.poison.done(&self.poison); + self.lock.inner.raw_unlock(); } } } @@ -466,11 +464,11 @@ impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> { } pub fn guard_lock<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a sys::Mutex { - &guard.__lock.inner + &guard.lock.inner } pub fn guard_poison<'a, T: ?Sized>(guard: &MutexGuard<'a, T>) -> &'a poison::Flag { - &guard.__lock.poison + &guard.lock.poison } #[cfg(all(test, not(target_os = "emscripten")))] diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index b1b56f321fc..c217291a42e 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -87,7 +87,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {} #[must_use = "if unused the RwLock will immediately unlock"] #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { - __lock: &'a RwLock<T>, + lock: &'a RwLock<T>, } #[stable(feature = "rust1", since = "1.0.0")] @@ -108,8 +108,8 @@ unsafe impl<T: ?Sized + Sync> Sync for RwLockReadGuard<'_, T> {} #[must_use = "if unused the RwLock will immediately unlock"] #[stable(feature = "rust1", since = "1.0.0")] pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> { - __lock: &'a RwLock<T>, - __poison: poison::Guard, + lock: &'a RwLock<T>, + poison: poison::Guard, } #[stable(feature = "rust1", since = "1.0.0")] @@ -465,7 +465,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { -> LockResult<RwLockReadGuard<'rwlock, T>> { poison::map_result(lock.poison.borrow(), |_| { RwLockReadGuard { - __lock: lock, + lock: lock, } }) } @@ -476,8 +476,8 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> { -> LockResult<RwLockWriteGuard<'rwlock, T>> { poison::map_result(lock.poison.borrow(), |guard| { RwLockWriteGuard { - __lock: lock, - __poison: guard, + lock: lock, + poison: guard, } }) } @@ -487,7 +487,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> { impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RwLockReadGuard") - .field("lock", &self.__lock) + .field("lock", &self.lock) .finish() } } @@ -503,7 +503,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'_, T> { impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RwLockWriteGuard") - .field("lock", &self.__lock) + .field("lock", &self.lock) .finish() } } @@ -520,7 +520,7 @@ impl<T: ?Sized> Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - unsafe { &*self.__lock.data.get() } + unsafe { &*self.lock.data.get() } } } @@ -529,29 +529,29 @@ impl<T: ?Sized> Deref for RwLockWriteGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - unsafe { &*self.__lock.data.get() } + unsafe { &*self.lock.data.get() } } } #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> DerefMut for RwLockWriteGuard<'_, T> { fn deref_mut(&mut self) -> &mut T { - unsafe { &mut *self.__lock.data.get() } + unsafe { &mut *self.lock.data.get() } } } #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Drop for RwLockReadGuard<'_, T> { fn drop(&mut self) { - unsafe { self.__lock.inner.read_unlock(); } + unsafe { self.lock.inner.read_unlock(); } } } #[stable(feature = "rust1", since = "1.0.0")] impl<T: ?Sized> Drop for RwLockWriteGuard<'_, T> { fn drop(&mut self) { - self.__lock.poison.done(&self.__poison); - unsafe { self.__lock.inner.write_unlock(); } + self.lock.poison.done(&self.poison); + unsafe { self.lock.inner.write_unlock(); } } } |
