diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-06-07 17:50:45 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-06-07 17:52:48 -0700 |
| commit | 6b3d3803eb8437907153bbb1b3c3978b29cd3a3b (patch) | |
| tree | 2378b0d96f006e4dd83fceaab9e36ab502415e07 /src/libcore | |
| parent | 92221aba7b5f3e1688548cb97f51a21da981e3e2 (diff) | |
| download | rust-6b3d3803eb8437907153bbb1b3c3978b29cd3a3b.tar.gz rust-6b3d3803eb8437907153bbb1b3c3978b29cd3a3b.zip | |
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.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cmp.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 5c3e891a2f8..b25f69bca40 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -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`. |
