Skip to content

Commit 9361423

Browse files
authored
Clarify upfront that PartialOrd is for strict partial orders
1 parent ae3e8c6 commit 9361423

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

library/core/src/cmp.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
//! * [`Eq`] indicates that the overloaded `==` operator corresponds to an
1010
//! equivalence relation.
1111
//! * [`Ord`] and [`PartialOrd`] are traits that allow you to define total and
12-
//! partial orderings between values, respectively. Implementing them overloads
13-
//! the `<`, `<=`, `>`, and `>=` operators.
12+
//! strict partial orderings between values, respectively. Implementing them
13+
//! overloads the `<`, `<=`, `>`, and `>=` operators.
1414
//! * [`Ordering`] is an enum returned by the main functions of [`Ord`] and
1515
//! [`PartialOrd`], and describes an ordering of two values (less, equal, or
1616
//! greater).
@@ -1095,7 +1095,7 @@ pub macro Ord($item:item) {
10951095
/* compiler built-in */
10961096
}
10971097

1098-
/// Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).
1098+
/// Trait for types that form a [strict partial order](https://en.wikipedia.org/wiki/Strict_partial_order).
10991099
///
11001100
/// The `lt`, `le`, `gt`, and `ge` methods of this trait can be called using the `<`, `<=`, `>`, and
11011101
/// `>=` operators, respectively.
@@ -1163,7 +1163,8 @@ pub macro Ord($item:item) {
11631163
/// The following corollaries follow from the above requirements:
11641164
///
11651165
/// - irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`
1166-
/// - transitivity of `>`: if `a > b` and `b > c` then `a > c`
1166+
/// - transitivity of `>`: if `a > b` and `b > c`, then `a > c`
1167+
/// - antisymmetry of `<=`: if `a <= b` and `b <= a`, then `a == b`
11671168
/// - duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`
11681169
///
11691170
/// ## Strict and non-strict partial orders

0 commit comments

Comments
 (0)