]> git.lizzy.rs Git - rust.git/commitdiff
Specify criterion for PartialOrd
authorCzipperz <czipperz@gmail.com>
Sun, 30 Dec 2018 00:14:06 +0000 (19:14 -0500)
committerCzipperz <czipperz@gmail.com>
Sun, 30 Dec 2018 00:14:06 +0000 (19:14 -0500)
src/libcore/cmp.rs

index 8eff9a8c8a26a0668d5d1d06bc4ac73d804a98ce..f420d0d00a4011b07320c7eb0f454d719ee2dba4 100644 (file)
@@ -474,8 +474,9 @@ fn cmp(&self, other: &Reverse<T>) -> Ordering {
 ///
 /// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must*
 /// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if
-/// and only if `a == b`. It's easy to accidentally make them disagree
-/// by deriving some of the traits and manually implementing others.
+/// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for
+/// all `a` and `b`. It's easy to accidentally make them disagree by
+/// deriving some of the traits and manually implementing others.
 ///
 /// Here's an example where you want to sort people by height only, disregarding `id`
 /// and `name`: