From 844be5eaa116820b14642b0893c288ba13a99e7f Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Tue, 20 Sep 2022 15:12:39 +0800 Subject: [PATCH] Fix `ReentrantMutexGuard::try_map` signature This previously incorrectly used `&mut T` instead of `&T`. Fixes #354 --- lock_api/src/remutex.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lock_api/src/remutex.rs b/lock_api/src/remutex.rs index fa0e934d..c450798d 100644 --- a/lock_api/src/remutex.rs +++ b/lock_api/src/remutex.rs @@ -654,10 +654,10 @@ impl<'a, R: RawMutex + 'a, G: GetThreadId + 'a, T: ?Sized + 'a> ReentrantMutexGu f: F, ) -> Result, 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), };