Skip to content

Commit a63880c

Browse files
committed
PartialEq: handle longer transitive chains
1 parent e1fadb2 commit a63880c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/core/src/cmp.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,13 @@ use self::Ordering::*;
6161
/// The equality relation `==` must satisfy the following conditions
6262
/// (for all `a`, `b`, `c` of type `A`, `B`, `C`):
6363
///
64-
/// - **Symmetric**: if `A: PartialEq<B>` and `B: PartialEq<A>`, then **`a == b`
64+
/// - **Symmetry**: if `A: PartialEq<B>` and `B: PartialEq<A>`, then **`a == b`
6565
/// implies `b == a`**; and
6666
///
67-
/// - **Transitive**: if `A: PartialEq<B>` and `B: PartialEq<C>` and `A:
67+
/// - **Transitivity**: if `A: PartialEq<B>` and `B: PartialEq<C>` and `A:
6868
/// PartialEq<C>`, then **`a == b` and `b == c` implies `a == c`**.
69+
/// This must also work for longer chains, such as when `A: PartialEq<B>`, `B: PartialEq<C>`,
70+
/// `C: PartialEq<D>`, and `A: PartialEq<D>` all exist.
6971
///
7072
/// Note that the `B: PartialEq<A>` (symmetric) and `A: PartialEq<C>`
7173
/// (transitive) impls are not forced to exist, but these requirements apply

0 commit comments

Comments
 (0)