Skip to content

Commit

Permalink
Clarify restrictions on ne
Browse files Browse the repository at this point in the history
I can't think of any sane cases where this restriction would not hold,
and the standard library seems to assume it pretty much everywhere.
  • Loading branch information
sfackler committed Jun 8, 2014
1 parent 92221ab commit 6b3d380
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libcore/cmp.rs
Expand Up @@ -43,8 +43,10 @@
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
/// so floating point types implement `PartialEq` but not `Eq`.
///
/// PartialEq only requires the `eq` method to be implemented; `ne` is its
/// negation by default.
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined
/// in terms of it by default. Any manual implementation of `ne` *must* respect
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
/// only if `a != b`.
///
/// Eventually, this will be implemented by default for types that implement
/// `Eq`.
Expand Down

5 comments on commit 6b3d380

@bors
Copy link
Contributor

@bors bors commented on 6b3d380 Jun 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at sfackler@6b3d380

@bors
Copy link
Contributor

@bors bors commented on 6b3d380 Jun 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sfackler/rust/partial-eq-nan-docs = 6b3d380 into auto

@bors
Copy link
Contributor

@bors bors commented on 6b3d380 Jun 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfackler/rust/partial-eq-nan-docs = 6b3d380 merged ok, testing candidate = bbd448a

@bors
Copy link
Contributor

@bors bors commented on 6b3d380 Jun 8, 2014

@bors
Copy link
Contributor

@bors bors commented on 6b3d380 Jun 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = bbd448a

Please sign in to comment.