about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-09-19 22:53:54 +0200
committerGitHub <noreply@github.com>2025-09-19 22:53:54 +0200
commit96a4ae3ab9b4bcf20837726169be2b1b46201e53 (patch)
treebdb02e28cc73936d8626db817fb8aaedcd5d43c8
parent59043567a5cf12800e1457c36ad6a6b0fa02c6b6 (diff)
parent8d7ec96c00994e3e4da652201792ae2040c979c1 (diff)
downloadrust-96a4ae3ab9b4bcf20837726169be2b1b46201e53.tar.gz
rust-96a4ae3ab9b4bcf20837726169be2b1b46201e53.zip
Rollup merge of #146690 - npmccallum:convo, r=tgross35
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?
-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