Skip to content

Commit 4a9f3ca

Browse files
committed
Add diagnostic items for Ord and PartialOrd methods
1 parent c5e7f45 commit 4a9f3ca

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

compiler/rustc_span/src/symbol.rs

+7
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,15 @@ symbols! {
531531
cmp,
532532
cmp_max,
533533
cmp_min,
534+
cmp_ord_max,
535+
cmp_ord_min,
534536
cmp_partialeq_eq,
535537
cmp_partialeq_ne,
538+
cmp_partialord_cmp,
539+
cmp_partialord_ge,
540+
cmp_partialord_gt,
541+
cmp_partialord_le,
542+
cmp_partialord_lt,
536543
cmpxchg16b_target_feature,
537544
cmse_nonsecure_entry,
538545
coerce_unsized,

library/core/src/cmp.rs

+7
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
848848
#[stable(feature = "ord_max_min", since = "1.21.0")]
849849
#[inline]
850850
#[must_use]
851+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_max")]
851852
fn max(self, other: Self) -> Self
852853
where
853854
Self: Sized,
@@ -868,6 +869,7 @@ pub trait Ord: Eq + PartialOrd<Self> {
868869
#[stable(feature = "ord_max_min", since = "1.21.0")]
869870
#[inline]
870871
#[must_use]
872+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_ord_min")]
871873
fn min(self, other: Self) -> Self
872874
where
873875
Self: Sized,
@@ -1154,6 +1156,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
11541156
/// ```
11551157
#[must_use]
11561158
#[stable(feature = "rust1", since = "1.0.0")]
1159+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_cmp")]
11571160
fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
11581161

11591162
/// 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> {
11681171
#[inline]
11691172
#[must_use]
11701173
#[stable(feature = "rust1", since = "1.0.0")]
1174+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_lt")]
11711175
fn lt(&self, other: &Rhs) -> bool {
11721176
matches!(self.partial_cmp(other), Some(Less))
11731177
}
@@ -1185,6 +1189,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
11851189
#[inline]
11861190
#[must_use]
11871191
#[stable(feature = "rust1", since = "1.0.0")]
1192+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_le")]
11881193
fn le(&self, other: &Rhs) -> bool {
11891194
matches!(self.partial_cmp(other), Some(Less | Equal))
11901195
}
@@ -1201,6 +1206,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
12011206
#[inline]
12021207
#[must_use]
12031208
#[stable(feature = "rust1", since = "1.0.0")]
1209+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_gt")]
12041210
fn gt(&self, other: &Rhs) -> bool {
12051211
matches!(self.partial_cmp(other), Some(Greater))
12061212
}
@@ -1218,6 +1224,7 @@ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
12181224
#[inline]
12191225
#[must_use]
12201226
#[stable(feature = "rust1", since = "1.0.0")]
1227+
#[cfg_attr(not(bootstrap), rustc_diagnostic_item = "cmp_partialord_ge")]
12211228
fn ge(&self, other: &Rhs) -> bool {
12221229
matches!(self.partial_cmp(other), Some(Greater | Equal))
12231230
}

0 commit comments

Comments
 (0)