@@ -68,7 +68,8 @@ pub enum IpAddr {
6868/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex 
6969/// ``` 
7070#[ rustc_diagnostic_item = "Ipv4Addr" ]  
71- #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ) ]  
71+ #[ derive( Copy ,  Clone ) ]  
72+ #[ derive_const( PartialEq ,  Eq ) ]  
7273#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
7374pub  struct  Ipv4Addr  { 
7475 octets :  [ u8 ;  4 ] , 
@@ -161,7 +162,8 @@ impl Hash for Ipv4Addr {
161162/// assert_eq!(localhost.is_loopback(), true); 
162163/// ``` 
163164#[ rustc_diagnostic_item = "Ipv6Addr" ]  
164- #[ derive( Copy ,  Clone ,  PartialEq ,  Eq ) ]  
165+ #[ derive( Copy ,  Clone ) ]  
166+ #[ derive_const( PartialEq ,  Eq ) ]  
165167#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
166168pub  struct  Ipv6Addr  { 
167169 octets :  [ u8 ;  16 ] , 
@@ -1183,7 +1185,8 @@ impl PartialEq<IpAddr> for Ipv4Addr {
11831185} 
11841186
11851187#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1186- impl  PartialOrd  for  Ipv4Addr  { 
1188+ #[ rustc_const_unstable( feature = "const_cmp" ,  issue = "143800" ) ]  
1189+ impl  const  PartialOrd  for  Ipv4Addr  { 
11871190 #[ inline]  
11881191 fn  partial_cmp ( & self ,  other :  & Ipv4Addr )  -> Option < Ordering >  { 
11891192 Some ( self . cmp ( other) ) 
@@ -1213,7 +1216,8 @@ impl PartialOrd<IpAddr> for Ipv4Addr {
12131216} 
12141217
12151218#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
1216- impl  Ord  for  Ipv4Addr  { 
1219+ #[ rustc_const_unstable( feature = "const_cmp" ,  issue = "143800" ) ]  
1220+ impl  const  Ord  for  Ipv4Addr  { 
12171221 #[ inline]  
12181222 fn  cmp ( & self ,  other :  & Ipv4Addr )  -> Ordering  { 
12191223 self . octets . cmp ( & other. octets ) 
@@ -2177,7 +2181,8 @@ impl PartialEq<Ipv6Addr> for IpAddr {
21772181} 
21782182
21792183#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
2180- impl  PartialOrd  for  Ipv6Addr  { 
2184+ #[ rustc_const_unstable( feature = "const_cmp" ,  issue = "143800" ) ]  
2185+ impl  const  PartialOrd  for  Ipv6Addr  { 
21812186 #[ inline]  
21822187 fn  partial_cmp ( & self ,  other :  & Ipv6Addr )  -> Option < Ordering >  { 
21832188 Some ( self . cmp ( other) ) 
@@ -2207,7 +2212,8 @@ impl PartialOrd<IpAddr> for Ipv6Addr {
22072212} 
22082213
22092214#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
2210- impl  Ord  for  Ipv6Addr  { 
2215+ #[ rustc_const_unstable( feature = "const_cmp" ,  issue = "143800" ) ]  
2216+ impl  const  Ord  for  Ipv6Addr  { 
22112217 #[ inline]  
22122218 fn  cmp ( & self ,  other :  & Ipv6Addr )  -> Ordering  { 
22132219 self . segments ( ) . cmp ( & other. segments ( ) ) 
0 commit comments