Skip to content

Commit f2719e9

Browse files
committed
PartialEq: handle longer transitive chains
1 parent 26089ba commit f2719e9

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
@@ -53,11 +53,13 @@ use self::Ordering::*;
5353
/// The equality relation `==` must satisfy the following conditions
5454
/// (for all `a`, `b`, `c` of type `A`, `B`, `C`):
5555
///
56-
/// - **Symmetric**: if `A: PartialEq<B>` and `B: PartialEq<A>`, then **`a == b`
56+
/// - **Symmetry**: if `A: PartialEq<B>` and `B: PartialEq<A>`, then **`a == b`
5757
/// implies `b == a`**; and
5858
///
59-
/// - **Transitive**: if `A: PartialEq<B>` and `B: PartialEq<C>` and `A:
59+
/// - **Transitivity**: if `A: PartialEq<B>` and `B: PartialEq<C>` and `A:
6060
/// PartialEq<C>`, then **`a == b` and `b == c` implies `a == c`**.
61+
/// This must also work for longer chains, such as when `A: PartialEq<B>`, `B: PartialEq<C>`,
62+
/// `C: PartialEq<D>`, and `A: PartialEq<D>` all exist.
6163
///
6264
/// Note that the `B: PartialEq<A>` (symmetric) and `A: PartialEq<C>`
6365
/// (transitive) impls are not forced to exist, but these requirements apply

0 commit comments

Comments
 (0)