PartialEq, PartialOrd: update and synchronize handling of transitive chains by RalfJung · Pull Request #115386 · rust-lang/rust (original) (raw)
I have removed the new paragraph about dealing with the multi-crate situation. Now all this PR does is un-do a likely accidental side-effect of #81198: before that PR, it was the case that if A: PartialEq<B>
and B: PartialEq<C>
and C: PartialEq<D>
and A: PartialEq<D>
all hold, then if a == b == c == d
, we have a == d
. After #81198, that was no longer required. I found no discussion indicating that this was deliberate, and it seems like a property that we would want, so I propose that we revert this accidental change and require this property again.
It is true that this transitivity requirement cannot be upheld on a per-crate level. However, that is already the case for the transitivity requirement that we have documented right now. In other words, the docs are already somewhat aspirational when it comes to multi-crate situations. Therefore I think we really should document that, ideally, this property holds for longer chains as well.
#118108 does the same thing for PartialOrd
. There, the equivalent of #81198 has not been applied yet, so we don't have to revert any prior changes. I think it would be a mistake to lose the transitive-chain property on <
, so I made #118108 preserve that property. So another way to think of this PR here is as restoring consistency between PartialEq
and PartialOrd
.
Re-nominating due to the changed PR contents and the new information (this un-does a likely accidental change, bringing us closer to how things were documented before 2021, rather than introducing something completely new).