Skip to content

Commit fc4dc5f

Browse files
Rollup merge of #77164 - fusion-engineering-forks:no-more-funny-underscores, r=Mark-Simulacrum
Remove workaround for deref issue that no longer exists. The double underscores were used to work around issue #12808, which was solved in 2016.
2 parents b8d158b + 13dc237 commit fc4dc5f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

library/std/src/sys_common/remutex.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ impl<T> RefUnwindSafe for ReentrantMutex<T> {}
3737
/// guarded data.
3838
#[must_use = "if unused the ReentrantMutex will immediately unlock"]
3939
pub struct ReentrantMutexGuard<'a, T: 'a> {
40-
// funny underscores due to how Deref currently works (it disregards field
41-
// privacy).
42-
__lock: &'a ReentrantMutex<T>,
40+
lock: &'a ReentrantMutex<T>,
4341
}
4442

4543
impl<T> !marker::Send for ReentrantMutexGuard<'_, T> {}
@@ -129,23 +127,23 @@ impl<T: fmt::Debug + 'static> fmt::Debug for ReentrantMutex<T> {
129127

130128
impl<'mutex, T> ReentrantMutexGuard<'mutex, T> {
131129
fn new(lock: &'mutex ReentrantMutex<T>) -> ReentrantMutexGuard<'mutex, T> {
132-
ReentrantMutexGuard { __lock: lock }
130+
ReentrantMutexGuard { lock }
133131
}
134132
}
135133

136134
impl<T> Deref for ReentrantMutexGuard<'_, T> {
137135
type Target = T;
138136

139137
fn deref(&self) -> &T {
140-
&self.__lock.data
138+
&self.lock.data
141139
}
142140
}
143141

144142
impl<T> Drop for ReentrantMutexGuard<'_, T> {
145143
#[inline]
146144
fn drop(&mut self) {
147145
unsafe {
148-
self.__lock.inner.unlock();
146+
self.lock.inner.unlock();
149147
}
150148
}
151149
}

0 commit comments

Comments
 (0)