Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for deref issue that no longer exists. #77164

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions library/std/src/sys_common/remutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ impl<T> RefUnwindSafe for ReentrantMutex<T> {}
/// 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<T>,
lock: &'a ReentrantMutex<T>,
}

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

impl<'mutex, T> ReentrantMutexGuard<'mutex, T> {
fn new(lock: &'mutex ReentrantMutex<T>) -> ReentrantMutexGuard<'mutex, T> {
ReentrantMutexGuard { __lock: lock }
ReentrantMutexGuard { lock }
}
}

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

fn deref(&self) -> &T {
&self.__lock.data
&self.lock.data
}
}

impl<T> Drop for ReentrantMutexGuard<'_, T> {
#[inline]
fn drop(&mut self) {
unsafe {
self.__lock.inner.unlock();
self.lock.inner.unlock();
}
}
}