Skip to content

Commit

Permalink
refact: add missing lifetime to AsDeref and AsDerefMut
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromfedricci committed Nov 26, 2024
1 parent 1c5c650 commit 10e3533
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/inner/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<T: ?Sized, L: Lock, W: Wait> Mutex<T, L, W> {
// SAFETY: The predecessor is guaranteed to be not null, since the tail
// is initialized with a valid allocation, and all tail updates point
// to valid, heap allocated nodes that outlive the predecessor thread.
unsafe { &*prev }.lock.wait_lock_relaxed::<W>();
unsafe { &(*prev).lock }.wait_lock_relaxed::<W>();
fence(Acquire);
MutexGuard::new(self, node)
}
Expand Down
6 changes: 4 additions & 2 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ impl<T: Deref> AsDeref for T {

type Deref<'a> = &'a <Self as Deref>::Target
where
Self: 'a;
Self: 'a,
Self::Target: 'a;

fn as_deref(&self) -> Self::Deref<'_> {
self
Expand All @@ -80,7 +81,8 @@ impl<T: Deref> AsDeref for T {
impl<T: DerefMut> AsDerefMut for T {
type DerefMut<'a> = &'a mut <Self as Deref>::Target
where
Self: 'a;
Self: 'a,
Self::Target: 'a;

fn as_deref_mut(&mut self) -> Self::DerefMut<'_> {
self
Expand Down

0 comments on commit 10e3533

Please sign in to comment.