Skip to content

Commit 6b3d380

Browse files
committed
Clarify restrictions on ne
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.
1 parent 92221ab commit 6b3d380

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libcore/cmp.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
/// equivalence relation. For example, in floating point numbers `NaN != NaN`,
4444
/// so floating point types implement `PartialEq` but not `Eq`.
4545
///
46-
/// PartialEq only requires the `eq` method to be implemented; `ne` is its
47-
/// negation by default.
46+
/// PartialEq only requires the `eq` method to be implemented; `ne` is defined
47+
/// in terms of it by default. Any manual implementation of `ne` *must* respect
48+
/// the rule that `eq` is a strict inverse of `ne`; that is, `!(a == b)` if and
49+
/// only if `a != b`.
4850
///
4951
/// Eventually, this will be implemented by default for types that implement
5052
/// `Eq`.

0 commit comments

Comments
 (0)