1
Fork 0

Add diagnostic items for Ord and PartialOrd methods

This commit is contained in:
Urgau 2024-02-18 15:21:44 +01:00
parent c5e7f45b62
commit 4a9f3cac88
2 changed files with 14 additions and 0 deletions

View file

@ -531,8 +531,15 @@ symbols! {
cmp, cmp,
cmp_max, cmp_max,
cmp_min, cmp_min,
cmp_ord_max,
cmp_ord_min,
cmp_partialeq_eq, cmp_partialeq_eq,
cmp_partialeq_ne, cmp_partialeq_ne,
cmp_partialord_cmp,
cmp_partialord_ge,
cmp_partialord_gt,
cmp_partialord_le,
cmp_partialord_lt,
cmpxchg16b_target_feature, cmpxchg16b_target_feature,
cmse_nonsecure_entry, cmse_nonsecure_entry,
coerce_unsized, coerce_unsized,

View file

@ -848,6 +848,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
#[stable(feature = "ord_max_min", since = "1.21.0")] #[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline] #[inline]
#[must_use] #[must_use]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_max")]
fn max(self, other: Self) -> Self fn max(self, other: Self) -> Self
where where
Self: Sized, Self: Sized,
@ -868,6 +869,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
#[stable(feature = "ord_max_min", since = "1.21.0")] #[stable(feature = "ord_max_min", since = "1.21.0")]
#[inline] #[inline]
#[must_use] #[must_use]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_min")]
fn min(self, other: Self) -> Self fn min(self, other: Self) -> Self
where where
Self: Sized, Self: Sized,
@ -1154,6 +1156,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
/// ``` /// ```
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_cmp")]
fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>; fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
/// This method tests less than (for `self` and `other`) and is used by the `<` operator. /// This method tests less than (for `self` and `other`) and is used by the `<` operator.
@ -1168,6 +1171,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_lt")]
fn lt(&self, other: &Rhs) -> bool { fn lt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less)) matches!(self.partial_cmp(other), Some(Less))
} }
@ -1185,6 +1189,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_le")]
fn le(&self, other: &Rhs) -> bool { fn le(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Less | Equal)) matches!(self.partial_cmp(other), Some(Less | Equal))
} }
@ -1201,6 +1206,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_gt")]
fn gt(&self, other: &Rhs) -> bool { fn gt(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater)) matches!(self.partial_cmp(other), Some(Greater))
} }
@ -1218,6 +1224,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
#[inline] #[inline]
#[must_use] #[must_use]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_ge")]
fn ge(&self, other: &Rhs) -> bool { fn ge(&self, other: &Rhs) -> bool {
matches!(self.partial_cmp(other), Some(Greater | Equal)) matches!(self.partial_cmp(other), Some(Greater | Equal))
} }