Skip to content

Documentation should clarify what it means for PartialEq and Ord/PartialOrd to "agree" #67938

Closed as not planned
@dfoxfranke

Description

@dfoxfranke

It's obvious that if a == b, then a.partialCmp(b) == Some(Ordering::Equal). But what about the converse? Can == implement a stricter sense of equality than partialCmp does? For example, suppose I have a type that wraps Arc<String>. Could I legally give it Ord/PartialOrd instances that compare the Strings, while giving it Eq/PartialEq instances that call ptr_eq on the Arc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions