mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Rollup merge of #78627 - est31:total_cmp_no_superset, r=m-ou-se
Point out that total_cmp is no strict superset of partial comparison Partial comparison and total_cmp are not equal. This helps preventing the mistake of creating float wrappers that base their Ord impl on total_cmp and their PartialOrd impl on the PartialOrd impl of the float type. PartialOrd and Ord [are required to agree with each other](https://doc.rust-lang.org/std/cmp/trait.Ord.html#how-can-i-implement-ord).
This commit is contained in:
commit
fb7948e7c1
@ -876,6 +876,10 @@ impl f32 {
|
||||
/// - Positive signaling NaN
|
||||
/// - Positive quiet NaN
|
||||
///
|
||||
/// Note that this function does not always agree with the [`PartialOrd`]
|
||||
/// and [`PartialEq`] implementations of `f32`. In particular, they regard
|
||||
/// negative and positive zero as equal, while `total_cmp` doesn't.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// #![feature(total_cmp)]
|
||||
|
@ -890,6 +890,10 @@ impl f64 {
|
||||
/// - Positive signaling NaN
|
||||
/// - Positive quiet NaN
|
||||
///
|
||||
/// Note that this function does not always agree with the [`PartialOrd`]
|
||||
/// and [`PartialEq`] implementations of `f64`. In particular, they regard
|
||||
/// negative and positive zero as equal, while `total_cmp` doesn't.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// #![feature(total_cmp)]
|
||||
|
Loading…
Reference in New Issue
Block a user