From 8758083aad5d455e83fc3ea630d991195b0c588c Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 19 Jan 2021 14:26:02 -0800 Subject: [PATCH] Remove requirement that forces symmetric and transitive PartialEq impls to exist --- library/core/src/cmp.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index b983f49eb1782..4a15b185a83e7 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -31,14 +31,18 @@ use self::Ordering::*; /// equivalence relation. For example, in floating point numbers `NaN != NaN`, /// so floating point types implement `PartialEq` but not [`trait@Eq`]. /// -/// Formally, the equality must be (for all `a`, `b` and `c`): +/// Formally, the equality must be (for all `a`, `b`, `c` of type `A`, `B`, +/// `C`): /// -/// - symmetric: `a == b` implies `b == a`; and -/// - transitive: `a == b` and `b == c` implies `a == c`. +/// - **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b` +/// implies `b == a`**; and +/// +/// - **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A: +/// PartialEq`, then **`a == b` and `b == c` implies `a == c`**. /// -/// Note that these requirements mean that the trait itself must be implemented -/// symmetrically and transitively: if `T: PartialEq` and `U: PartialEq` -/// then `U: PartialEq` and `T: PartialEq`. +/// Note that the `B: PartialEq` (symmetric) and `A: PartialEq` +/// (transitive) impls are not forced to exist, but these requirements apply +/// whenever they do exist. /// /// ## Derivable ///