|
23 | 23 | #![stable(feature = "rust1", since = "1.0.0")]
|
24 | 24 |
|
25 | 25 | use crate::marker::Destruct;
|
| 26 | +use crate::marker::StructuralPartialEq; |
26 | 27 |
|
27 | 28 | use self::Ordering::*;
|
28 | 29 |
|
@@ -338,7 +339,7 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
|
338 | 339 | /// let result = 2.cmp(&1);
|
339 | 340 | /// assert_eq!(Ordering::Greater, result);
|
340 | 341 | /// ```
|
341 |
| -#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] |
| 342 | +#[derive(Clone, Copy, Eq, Debug, Hash)] |
342 | 343 | #[stable(feature = "rust1", since = "1.0.0")]
|
343 | 344 | #[repr(i8)]
|
344 | 345 | pub enum Ordering {
|
@@ -884,6 +885,18 @@ pub macro Ord($item:item) {
|
884 | 885 | /* compiler built-in */
|
885 | 886 | }
|
886 | 887 |
|
| 888 | +#[stable(feature = "rust1", since = "1.0.0")] |
| 889 | +impl StructuralPartialEq for Ordering {} |
| 890 | + |
| 891 | +#[stable(feature = "rust1", since = "1.0.0")] |
| 892 | +#[rustc_const_unstable(feature = "const_cmp", issue = "92391")] |
| 893 | +impl const PartialEq for Ordering { |
| 894 | + #[inline] |
| 895 | + fn eq(&self, other: &Self) -> bool { |
| 896 | + (*self as i32).eq(&(*other as i32)) |
| 897 | + } |
| 898 | +} |
| 899 | + |
887 | 900 | #[stable(feature = "rust1", since = "1.0.0")]
|
888 | 901 | #[rustc_const_unstable(feature = "const_cmp", issue = "92391")]
|
889 | 902 | impl const Ord for Ordering {
|
|
0 commit comments