@@ -14,7 +14,8 @@ macro_rules! define_valid_range_type {
1414 $( #[ $m: meta] ) *
1515 $vis: vis struct $name: ident( $int: ident as $uint: ident in $low: literal..=$high: literal) ;
1616 ) +) => { $(
17- #[ derive( Clone , Copy , Eq ) ]
17+ #[ derive( Copy ) ]
18+ #[ derive_const( Clone , Eq ) ]
1819 #[ repr( transparent) ]
1920 #[ rustc_layout_scalar_valid_range_start( $low) ]
2021 #[ rustc_layout_scalar_valid_range_end( $high) ]
@@ -67,21 +68,24 @@ macro_rules! define_valid_range_type {
6768 // by <https://github.com/rust-lang/compiler-team/issues/807>.
6869 impl StructuralPartialEq for $name { }
6970
70- impl PartialEq for $name {
71+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
72+ impl const PartialEq for $name {
7173 #[ inline]
7274 fn eq( & self , other: & Self ) -> bool {
7375 self . as_inner( ) == other. as_inner( )
7476 }
7577 }
7678
77- impl Ord for $name {
79+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
80+ impl const Ord for $name {
7881 #[ inline]
7982 fn cmp( & self , other: & Self ) -> Ordering {
8083 Ord :: cmp( & self . as_inner( ) , & other. as_inner( ) )
8184 }
8285 }
8386
84- impl PartialOrd for $name {
87+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
88+ impl const PartialOrd for $name {
8589 #[ inline]
8690 fn partial_cmp( & self , other: & Self ) -> Option <Ordering > {
8791 Some ( Ord :: cmp( self , other) )
0 commit comments