@@ -68,7 +68,8 @@ pub enum IpAddr {
68
68
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
69
69
/// ```
70
70
#[ rustc_diagnostic_item = "Ipv4Addr" ]
71
- #[ derive( Copy , Clone , PartialEq , Eq ) ]
71
+ #[ derive( Copy , Clone ) ]
72
+ #[ derive_const( PartialEq , Eq ) ]
72
73
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
73
74
pub struct Ipv4Addr {
74
75
octets : [ u8 ; 4 ] ,
@@ -161,7 +162,8 @@ impl Hash for Ipv4Addr {
161
162
/// assert_eq!(localhost.is_loopback(), true);
162
163
/// ```
163
164
#[ rustc_diagnostic_item = "Ipv6Addr" ]
164
- #[ derive( Copy , Clone , PartialEq , Eq ) ]
165
+ #[ derive( Copy , Clone ) ]
166
+ #[ derive_const( PartialEq , Eq ) ]
165
167
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
166
168
pub struct Ipv6Addr {
167
169
octets : [ u8 ; 16 ] ,
@@ -1183,7 +1185,8 @@ impl PartialEq<IpAddr> for Ipv4Addr {
1183
1185
}
1184
1186
1185
1187
#[ 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 {
1187
1190
#[ inline]
1188
1191
fn partial_cmp ( & self , other : & Ipv4Addr ) -> Option < Ordering > {
1189
1192
Some ( self . cmp ( other) )
@@ -1213,7 +1216,8 @@ impl PartialOrd<IpAddr> for Ipv4Addr {
1213
1216
}
1214
1217
1215
1218
#[ 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 {
1217
1221
#[ inline]
1218
1222
fn cmp ( & self , other : & Ipv4Addr ) -> Ordering {
1219
1223
self . octets . cmp ( & other. octets )
@@ -2177,7 +2181,8 @@ impl PartialEq<Ipv6Addr> for IpAddr {
2177
2181
}
2178
2182
2179
2183
#[ 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 {
2181
2186
#[ inline]
2182
2187
fn partial_cmp ( & self , other : & Ipv6Addr ) -> Option < Ordering > {
2183
2188
Some ( self . cmp ( other) )
@@ -2207,7 +2212,8 @@ impl PartialOrd<IpAddr> for Ipv6Addr {
2207
2212
}
2208
2213
2209
2214
#[ 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 {
2211
2217
#[ inline]
2212
2218
fn cmp ( & self , other : & Ipv6Addr ) -> Ordering {
2213
2219
self . segments ( ) . cmp ( & other. segments ( ) )
0 commit comments