Documentation should clarify what it means for PartialEq and Ord/PartialOrd to "agree" #67938
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
It's obvious that if
a == b
, thena.partialCmp(b) == Some(Ordering::Equal)
. But what about the converse? Can==
implement a stricter sense of equality thanpartialCmp
does? For example, suppose I have a type that wrapsArc<String>
. Could I legally give itOrd/PartialOrd
instances that compare theString
s, while giving itEq/PartialEq
instances that callptr_eq
on theArc
?The text was updated successfully, but these errors were encountered: