Skip to content

Commit

Permalink
Fix ReentrantMutexGuard::try_map signature
Browse files Browse the repository at this point in the history
This previously incorrectly used `&mut T` instead of `&T`.

Fixes #354
  • Loading branch information
Amanieu committed Sep 20, 2022
1 parent e44aceb commit 844be5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lock_api/src/remutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,10 @@ impl<'a, R: RawMutex + 'a, G: GetThreadId + 'a, T: ?Sized + 'a> ReentrantMutexGu
f: F,
) -> Result<MappedReentrantMutexGuard<'a, R, G, U>, Self>
where
F: FnOnce(&mut T) -> Option<&mut U>,
F: FnOnce(&T) -> Option<&U>,
{
let raw = &s.remutex.raw;
let data = match f(unsafe { &mut *s.remutex.data.get() }) {
let data = match f(unsafe { &*s.remutex.data.get() }) {
Some(data) => data,
None => return Err(s),
};
Expand Down

0 comments on commit 844be5e

Please sign in to comment.