From fca926319e26e06545b10bdb0676b1bf366bdf6e Mon Sep 17 00:00:00 2001 From: Magic Len Date: Sat, 1 Jun 2024 14:05:13 +0800 Subject: [PATCH] fix the `bound_4` test case in `ord_struct` --- tests/ord_struct.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/ord_struct.rs b/tests/ord_struct.rs index aeedfcf..59d077b 100644 --- a/tests/ord_struct.rs +++ b/tests/ord_struct.rs @@ -536,14 +536,21 @@ fn bound_4() { let phantom = PhantomData::; #[derive(Educe)] - #[educe(Ord, PartialEq)] + #[educe(Ord)] struct Struct { f1: T, // PhantomData is Eq (all PhantomData are equal to all others) f2: PhantomData, } + impl PartialEq for Struct { + fn eq(&self, other: &Struct) -> bool { + self.f1.eq(&other.f1) + } + } + impl Eq for Struct {} + impl PartialOrd for Struct { fn partial_cmp(&self, other: &Struct) -> Option { self.f1.partial_cmp(&other.f1) @@ -551,10 +558,17 @@ fn bound_4() { } #[derive(Educe)] - #[educe(Ord, PartialEq)] + #[educe(Ord)] struct Tuple(T, PhantomData); + impl PartialEq for Tuple { + fn eq(&self, other: &Tuple) -> bool { + self.0.eq(&other.0) + } + } + impl Eq for Tuple {} + impl PartialOrd for Tuple { fn partial_cmp(&self, other: &Tuple) -> Option { self.0.partial_cmp(&other.0)