Skip to content

PartialOrd does not mention upfront that it omits reflexivity #140654

@Muon

Description

@Muon

Location

https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html

Summary

A partial order is a reflexive, antisymmetric and transitive relation. The docs for PartialOrd call it a "trait for types that form a partial order". However, we only require transitivity (explicitly) and antisymmetry (by implication from duality, conditions 1-4 in the docs for PartialOrd, and the symmetry of == from the docs of PartialEq). We cannot require reflexivity because f32 and f64 are PartialOrd but x == x is true for them iff x is not NaN, which is mentioned later, but it's a bit buried. The docs should make clear upfront that reflexivity is not required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsT-libsRelevant to the library 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