Skip to content

Commit

Permalink
sync: add ?Sized bound to {MutexGuard,OwnedMutexGuard}::map (#5997)
Browse files Browse the repository at this point in the history
  • Loading branch information
ennis authored Sep 10, 2023
1 parent 65027b6 commit 61f095f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tokio/src/sync/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> {
#[inline]
pub fn map<U, F>(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;
Expand Down Expand Up @@ -894,6 +895,7 @@ impl<'a, T: ?Sized> MutexGuard<'a, T> {
#[inline]
pub fn try_map<U, F>(mut this: Self, f: F) -> Result<MappedMutexGuard<'a, U>, Self>
where
U: ?Sized,
F: FnOnce(&mut T) -> Option<&mut U>,
{
let data = match f(&mut *this) {
Expand Down Expand Up @@ -1026,6 +1028,7 @@ impl<T: ?Sized> OwnedMutexGuard<T> {
#[inline]
pub fn map<U, F>(mut this: Self, f: F) -> OwnedMappedMutexGuard<T, U>
where
U: ?Sized,
F: FnOnce(&mut T) -> &mut U,
{
let data = f(&mut *this) as *mut U;
Expand Down Expand Up @@ -1074,6 +1077,7 @@ impl<T: ?Sized> OwnedMutexGuard<T> {
#[inline]
pub fn try_map<U, F>(mut this: Self, f: F) -> Result<OwnedMappedMutexGuard<T, U>, Self>
where
U: ?Sized,
F: FnOnce(&mut T) -> Option<&mut U>,
{
let data = match f(&mut *this) {
Expand Down

0 comments on commit 61f095f

Please sign in to comment.