-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FuzzyNum example in std::cmp documentation seems to violate PartialEq requirements #24173
Comments
I'm pretty sure it's just a sloppy example. |
A range type would be a better thing to use as an example as it would actually be partially ordered. |
(Note this is about partial eq, not ord.) Range types may work still. Or we could adapt the kernels example from the linked Wikipedia article. |
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Apr 20, 2015
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Apr 20, 2015
Fixes rust-lang#24173 These docs could all use examples, so for now, let's just remove the bad one, and when I go over this whole module I'll put in better ones.
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Apr 21, 2015
Fixes rust-lang#24173 These docs could all use examples, so for now, let's just remove the bad one, and when I go over this whole module I'll put in better ones.
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this issue
Apr 25, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the documentation for
PartialEq
, it mentions that the equality must be symmetric (a == b
impliesb == a
) and transitive (a == b
andb == c
impliesa == c
) to satisfy the partial equivalence relation.However, in
std::cmp
's documentation, it gives aPartialEq
example for aFuzzyNum
struct, but this does not appear to be transitive. For example, the fuzzy numbers 20 and 24 are equal, 24 and 28 are equal, but 20 and 28 are not equal.Is there something I'm missing here, or should the example be rewritten?
The text was updated successfully, but these errors were encountered: