From 93614234fc5e0de8b9b6815b3b93c61bd637b798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mak=20Naze=C4=8Di=C4=87-Andrlon?= Date: Thu, 8 May 2025 13:52:28 +1000 Subject: [PATCH] Clarify upfront that `PartialOrd` is for strict partial orders --- library/core/src/cmp.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index c315131f4136c..898fe3639fb2d 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -9,8 +9,8 @@ //! * [`Eq`] indicates that the overloaded `==` operator corresponds to an //! equivalence relation. //! * [`Ord`] and [`PartialOrd`] are traits that allow you to define total and -//! partial orderings between values, respectively. Implementing them overloads -//! the `<`, `<=`, `>`, and `>=` operators. +//! strict partial orderings between values, respectively. Implementing them +//! overloads the `<`, `<=`, `>`, and `>=` operators. //! * [`Ordering`] is an enum returned by the main functions of [`Ord`] and //! [`PartialOrd`], and describes an ordering of two values (less, equal, or //! greater). @@ -1095,7 +1095,7 @@ pub macro Ord($item:item) { /* compiler built-in */ } -/// Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order). +/// Trait for types that form a [strict partial order](https://en.wikipedia.org/wiki/Strict_partial_order). /// /// The `lt`, `le`, `gt`, and `ge` methods of this trait can be called using the `<`, `<=`, `>`, and /// `>=` operators, respectively. @@ -1163,7 +1163,8 @@ pub macro Ord($item:item) { /// The following corollaries follow from the above requirements: /// /// - irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)` -/// - transitivity of `>`: if `a > b` and `b > c` then `a > c` +/// - transitivity of `>`: if `a > b` and `b > c`, then `a > c` +/// - antisymmetry of `<=`: if `a <= b` and `b <= a`, then `a == b` /// - duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)` /// /// ## Strict and non-strict partial orders