File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -58,10 +58,18 @@ use self::Ordering::*;
58
58
///
59
59
/// - **Transitive**: if `A: PartialEq<B>` and `B: PartialEq<C>` and `A:
60
60
/// 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.
61
63
///
62
64
/// Note that the `B: PartialEq<A>` (symmetric) and `A: PartialEq<C>`
63
65
/// (transitive) impls are not forced to exist, but these requirements apply
64
66
/// 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.
65
73
///
66
74
/// ## Derivable
67
75
///
You can’t perform that action at this time.
0 commit comments