Skip to content

Commit 445dadc

Browse files
committed
Specify criterion for PartialOrd
1 parent cf3959c commit 445dadc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/cmp.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,9 @@ impl<T: Ord> Ord for Reverse<T> {
474474
///
475475
/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must*
476476
/// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if
477-
/// and only if `a == b`. It's easy to accidentally make them disagree
478-
/// by deriving some of the traits and manually implementing others.
477+
/// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for
478+
/// all `a` and `b`. It's easy to accidentally make them disagree by
479+
/// deriving some of the traits and manually implementing others.
479480
///
480481
/// Here's an example where you want to sort people by height only, disregarding `id`
481482
/// and `name`:

0 commit comments

Comments
 (0)