From 13dc237037c8ef66423639c622d6018f1cf9a37e Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 24 Sep 2020 20:50:09 +0200 Subject: [PATCH] Remove workaround for deref issue that no longer exists. The double underscores were used to work around issue #12808, which was solved in 2016. --- library/std/src/sys_common/remutex.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/library/std/src/sys_common/remutex.rs b/library/std/src/sys_common/remutex.rs index 360337c030be4..162eab2388d55 100644 --- a/library/std/src/sys_common/remutex.rs +++ b/library/std/src/sys_common/remutex.rs @@ -37,9 +37,7 @@ impl RefUnwindSafe for ReentrantMutex {} /// guarded data. #[must_use = "if unused the ReentrantMutex will immediately unlock"] pub struct ReentrantMutexGuard<'a, T: 'a> { - // funny underscores due to how Deref currently works (it disregards field - // privacy). - __lock: &'a ReentrantMutex, + lock: &'a ReentrantMutex, } impl !marker::Send for ReentrantMutexGuard<'_, T> {} @@ -129,7 +127,7 @@ impl fmt::Debug for ReentrantMutex { impl<'mutex, T> ReentrantMutexGuard<'mutex, T> { fn new(lock: &'mutex ReentrantMutex) -> ReentrantMutexGuard<'mutex, T> { - ReentrantMutexGuard { __lock: lock } + ReentrantMutexGuard { lock } } } @@ -137,7 +135,7 @@ impl Deref for ReentrantMutexGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - &self.__lock.data + &self.lock.data } } @@ -145,7 +143,7 @@ impl Drop for ReentrantMutexGuard<'_, T> { #[inline] fn drop(&mut self) { unsafe { - self.__lock.inner.unlock(); + self.lock.inner.unlock(); } } }