Skip to content

Commit 8aebbc1

Browse files
committed
improve wording
1 parent efa6f1e commit 8aebbc1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

library/core/src/cmp.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ use self::Ordering::*;
6464
/// Note that the `B: PartialEq<A>` (symmetric) and `A: PartialEq<C>`
6565
/// (transitive) impls are not forced to exist, but these requirements apply
6666
/// whenever they do exist.
67-
/// The requirement for transitive chains has a subtle consequence: if a crate `a` with type `A`
68-
/// importing types `B1`, `B2` from another crate `b` defines instances of both `A: PartialEq<B1>`
69-
/// and `B2: PartialEq<A>`, then if `b` adds a `B1: PartialEq<B2>` implementation in the future that
70-
/// could create new violations of transitivity. Effectively, crate `a` is making `B1` and `B2`
71-
/// comparable even though `b` does not permit comparing them. Crate `a` should generally refrain
72-
/// from doing that to avoid the potential for such conflicts.
67+
/// The requirement for transitive chains has a subtle consequence: consider a crate `alpha`
68+
/// defining type `A1` and `A2`, and a crate `beta` defining a type `B`. If `beta` uses `alpha` as a
69+
/// dependency and provides trait implementations for both `A1: PartialEq<B>` and `B:
70+
/// PartialEq<A2>`, the transitivity rules don't apply, as an implementation `A1: PartialEq<A2>`
71+
/// does not exist; but at a later point `alpha` could decide to add such a `A1: PartialEq<A2>`
72+
/// implementation, in a way that would then make `beta`'s traits implementations violate
73+
/// transitivity. Effectively, `beta` is already making `A1` and `A2` comparable for equality even
74+
/// though `alpha` does not permit comparing them. Crate `beta` should generally refrain from doing
75+
/// that to avoid the potential for such conflicts.
7376
///
7477
/// ## Derivable
7578
///

0 commit comments

Comments
 (0)