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.
This commit is contained in:
Steven Fackler 2014-06-07 17:50:45 -07:00
parent 92221aba7b
commit 6b3d3803eb

View file

@ -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`.