about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorNathaniel McCallum <nathaniel@mccallum.life>2025-09-12 18:35:21 -0400
committerNathaniel McCallum <nathaniel@mccallum.life>2025-09-17 16:39:01 -0500
commit8d7ec96c00994e3e4da652201792ae2040c979c1 (patch)
treeee728411249cf646cfed569588aaf608ee10235f /library/core/src
parent4645a7988177c286f61609cc667ecae4c571a2e8 (diff)
downloadrust-8d7ec96c00994e3e4da652201792ae2040c979c1.tar.gz
rust-8d7ec96c00994e3e4da652201792ae2040c979c1.zip
add `[const] PartialEq` bound to `PartialOrd`
This change is included for discussion purposes.

The PartialOrd bound on PartialEq is not strictly necessary. It
is, rather, logical: anything which is orderable should by
definition have equality. Is the same true for constness? Should
every type which is const orderable also have const equality?
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/cmp.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs
index 95896ab1441..7f369d19c3d 100644
--- a/library/core/src/cmp.rs
+++ b/library/core/src/cmp.rs
@@ -1351,7 +1351,9 @@ pub macro Ord($item:item) {
 #[rustc_diagnostic_item = "PartialOrd"]
 #[allow(multiple_supertrait_upcastable)] // FIXME(sized_hierarchy): remove this
 #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
-pub const trait PartialOrd<Rhs: PointeeSized = Self>: PartialEq<Rhs> + PointeeSized {
+pub const trait PartialOrd<Rhs: PointeeSized = Self>:
+    [const] PartialEq<Rhs> + PointeeSized
+{
     /// This method returns an ordering between `self` and `other` values if one exists.
     ///
     /// # Examples