diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs index 0700c260eb2..1d44e938bf5 100644 --- a/tokio/src/sync/mutex.rs +++ b/tokio/src/sync/mutex.rs @@ -846,6 +846,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> { #[inline] pub fn map(mut this: Self, f: F) -> MappedMutexGuard<'a, U> where + U: ?Sized, F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; @@ -894,6 +895,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> { #[inline] pub fn try_map(mut this: Self, f: F) -> Result, Self> where + U: ?Sized, F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) { @@ -1026,6 +1028,7 @@ impl OwnedMutexGuard { #[inline] pub fn map(mut this: Self, f: F) -> OwnedMappedMutexGuard where + U: ?Sized, F: FnOnce(&mut T) -> &mut U, { let data = f(&mut *this) as *mut U; @@ -1074,6 +1077,7 @@ impl OwnedMutexGuard { #[inline] pub fn try_map(mut this: Self, f: F) -> Result, Self> where + U: ?Sized, F: FnOnce(&mut T) -> Option<&mut U>, { let data = match f(&mut *this) {