mozilla/rust — pull request #12435 by thestinger (2014-02-21 02:22:54+00:00)
Title: require a total ordering for `Eq` and `Ord`

A total ordering is assumed and required for most generic functions
making use of these traits. The `cmp` method also provides a boost in
efficiency for sorting sequence types or storing them in a tree set/map
since otherwise two passes would often be required.

The standard hardware comparison operators for floats do not implement a
total order. However, IEEE754 does define an alternate total ordering
and Rust can switch to it for `Eq` and `Ord`. Intrinsics can be provided
for the traditional weak order and exposed via the `Float` trait. Fixing
this is now issue #12434.

Traits like `PartialEq` and `PartialOrd` could exist, but will never
permit a sane implementation. A type implementing `Eq` would be expected
to automatically implement `PartialEq` but floating point types have
*two* comparison definitions available. I don't think these would see
much usage anyway, because there are even alternate definitions of
functions as simple as `min`, `max` and `clamp` for floats.

Closes #5283
Closes #8071
Closes #10320