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?
This commit is contained in:
Matthias Krüger
2025-09-19 22:53:54 +02:00
committed by GitHub
+3 -1
View File
@@ -1351,7 +1351,9 @@ fn clamp(self, min: Self, max: Self) -> Self
#[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