From 7a8c36895dad2e7f5d58a839090ad8ff821d4040 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Sun, 21 Jan 2024 10:52:50 -0800 Subject: [PATCH] fix: fix unconditional recursion in `PartialEq` (#468) --- bitfield/src/pack.rs | 8 ++++---- maitake-sync/src/wait_map/tests/alloc_tests.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bitfield/src/pack.rs b/bitfield/src/pack.rs index a7b5de3a..ee8cb4db 100644 --- a/bitfield/src/pack.rs +++ b/bitfield/src/pack.rs @@ -769,14 +769,14 @@ macro_rules! make_packers { impl PartialEq<&'_ $Pack> for $Pack { #[inline] fn eq(&self, other: &&'_ $Pack) -> bool { - self.eq(*other) + >>::eq(self, *other) } } impl PartialEq<$Pack> for &'_ $Pack { #[inline] fn eq(&self, other: &$Pack) -> bool { - (*self).eq(other) + <$Pack as PartialEq<$Pack>>::eq(*self, other) } } @@ -1052,14 +1052,14 @@ macro_rules! make_packers { impl PartialEq<&'_ $Pair> for $Pair { #[inline] fn eq(&self, other: &&'_ $Pair) -> bool { - self.eq(*other) + >>::eq(self, *other) } } impl PartialEq<$Pair> for &'_ $Pair { #[inline] fn eq(&self, other: &$Pair) -> bool { - (*self).eq(other) + <$Pair as PartialEq<$Pair>>::eq(*self, other) } } diff --git a/maitake-sync/src/wait_map/tests/alloc_tests.rs b/maitake-sync/src/wait_map/tests/alloc_tests.rs index 32bedd24..375c44ed 100644 --- a/maitake-sync/src/wait_map/tests/alloc_tests.rs +++ b/maitake-sync/src/wait_map/tests/alloc_tests.rs @@ -205,7 +205,7 @@ struct CountDropKey { impl PartialEq for CountDropKey { fn eq(&self, other: &Self) -> bool { - self.idx.eq(&other.idx) + self.idx == other.idx } }