mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-06 03:52:53 +00:00
Rollup merge of #104912 - RalfJung:per, r=Mark-Simulacrum
PartialEq: PERs are homogeneous PartialEq claims that it corresponds to a PER, but that is only a well-defined statement when `Rhs == Self`. There is no standard notion of PER on a relation between two different sets/types. So move this out of the first paragraph and clarify this.
This commit is contained in:
commit
8ad447c479
@ -29,8 +29,7 @@ use crate::marker::StructuralPartialEq;
|
||||
|
||||
use self::Ordering::*;
|
||||
|
||||
/// Trait for equality comparisons which are [partial equivalence
|
||||
/// relations](https://en.wikipedia.org/wiki/Partial_equivalence_relation).
|
||||
/// Trait for equality comparisons.
|
||||
///
|
||||
/// `x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.
|
||||
/// We use the easier-to-read infix notation in the remainder of this documentation.
|
||||
@ -38,6 +37,8 @@ use self::Ordering::*;
|
||||
/// This trait allows for partial equality, for types that do not have a full
|
||||
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
|
||||
/// so floating point types implement `PartialEq` but not [`trait@Eq`].
|
||||
/// Formally speaking, when `Rhs == Self`, this trait corresponds to a [partial equivalence
|
||||
/// relation](https://en.wikipedia.org/wiki/Partial_equivalence_relation).
|
||||
///
|
||||
/// Implementations must ensure that `eq` and `ne` are consistent with each other:
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user