@@ -281,7 +281,8 @@ pub macro PartialEq($item:item) {
281281#[ doc( alias = "!=" ) ]
282282#[ stable( feature = "rust1" , since = "1.0.0" ) ]
283283#[ rustc_diagnostic_item = "Eq" ]
284- pub trait Eq : PartialEq < Self > {
284+ #[ const_trait]
285+ pub trait Eq : ~const PartialEq < Self > {
285286 // this method is used solely by #[deriving] to assert
286287 // that every component of a type implements #[deriving]
287288 // itself, the current deriving infrastructure means doing this
@@ -331,8 +332,9 @@ pub struct AssertParamIsEq<T: Eq + ?Sized> {
331332/// let result = 2.cmp(&1);
332333/// assert_eq!(Ordering::Greater, result);
333334/// ```
334- #[ derive( Clone , Copy , Eq , Debug , Hash ) ]
335- #[ cfg_attr( not( bootstrap) , derive_const( PartialOrd , Ord , PartialEq ) ) ]
335+ #[ derive( Clone , Copy , Debug , Hash ) ]
336+ #[ cfg_attr( bootstrap, derive( Ord , Eq ) ) ]
337+ #[ cfg_attr( not( bootstrap) , derive_const( PartialOrd , Ord , PartialEq , Eq ) ) ]
336338#[ stable( feature = "rust1" , since = "1.0.0" ) ]
337339#[ repr( i8 ) ]
338340pub enum Ordering {
@@ -762,7 +764,7 @@ impl<T: Clone> Clone for Reverse<T> {
762764#[ stable( feature = "rust1" , since = "1.0.0" ) ]
763765#[ rustc_diagnostic_item = "Ord" ]
764766#[ const_trait]
765- pub trait Ord : Eq + PartialOrd < Self > {
767+ pub trait Ord : ~ const Eq + ~ const PartialOrd < Self > {
766768 /// This method returns an [`Ordering`] between `self` and `other`.
767769 ///
768770 /// By convention, `self.cmp(&other)` returns the ordering matching the expression
@@ -892,16 +894,6 @@ impl const PartialEq for Ordering {
892894 }
893895}
894896
895- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
896- #[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
897- #[ cfg( bootstrap) ]
898- impl const Ord for Ordering {
899- #[ inline]
900- fn cmp ( & self , other : & Ordering ) -> Ordering {
901- ( * self as i32 ) . cmp ( & ( * other as i32 ) )
902- }
903- }
904-
905897#[ stable( feature = "rust1" , since = "1.0.0" ) ]
906898#[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
907899#[ cfg( bootstrap) ]
@@ -1231,9 +1223,8 @@ pub const fn min<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
12311223#[ stable( feature = "cmp_min_max_by" , since = "1.53.0" ) ]
12321224#[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
12331225pub const fn min_by < T , F : ~const FnOnce ( & T , & T ) -> Ordering > ( v1 : T , v2 : T , compare : F ) -> T
1234- where
1226+ where
12351227 T : ~const Destruct ,
1236- F : ~const Destruct ,
12371228{
12381229 match compare ( & v1, & v2) {
12391230 Ordering :: Less | Ordering :: Equal => v1,
@@ -1318,8 +1309,6 @@ pub const fn max<T: ~const Ord + ~const Destruct>(v1: T, v2: T) -> T {
13181309pub const fn max_by < T , F : ~const FnOnce ( & T , & T ) -> Ordering > ( v1 : T , v2 : T , compare : F ) -> T
13191310where
13201311 T : ~const Destruct ,
1321- F : ~const Destruct ,
1322- {
13231312 match compare( & v1 , & v2 ) {
13241313 Ordering :: Less | Ordering :: Equal => v2,
13251314 Ordering :: Greater => v1,
@@ -1399,7 +1388,8 @@ mod impls {
13991388 macro_rules! eq_impl {
14001389 ( $( $t: ty) * ) => ( $(
14011390 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1402- impl Eq for $t { }
1391+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
1392+ impl const Eq for $t { }
14031393 ) * )
14041394 }
14051395
@@ -1523,7 +1513,8 @@ mod impls {
15231513 }
15241514
15251515 #[ unstable( feature = "never_type" , issue = "35121" ) ]
1526- impl Eq for ! { }
1516+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
1517+ impl const Eq for ! { }
15271518
15281519 #[ unstable( feature = "never_type" , issue = "35121" ) ]
15291520 #[ rustc_const_unstable( feature = "const_cmp" , issue = "92391" ) ]
0 commit comments