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
commit 96a4ae3ab9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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