@@ -29,13 +29,16 @@ use super::display_buffer::DisplayBuffer;
29
29
/// assert_eq!(localhost_v4.is_ipv6(), false);
30
30
/// assert_eq!(localhost_v4.is_ipv4(), true);
31
31
/// ```
32
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "IpAddr" ) ]
32
33
#[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
33
34
#[ derive( Copy , Clone , Eq , PartialEq , Hash , PartialOrd , Ord ) ]
34
35
pub enum IpAddr {
35
36
/// An IPv4 address.
37
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "ip_addr_variant_v4" ) ]
36
38
#[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
37
39
V4 ( #[ stable( feature = "ip_addr" , since = "1.7.0" ) ] Ipv4Addr ) ,
38
40
/// An IPv6 address.
41
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "ip_addr_variant_v6" ) ]
39
42
#[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
40
43
V6 ( #[ stable( feature = "ip_addr" , since = "1.7.0" ) ] Ipv6Addr ) ,
41
44
}
@@ -72,6 +75,7 @@ pub enum IpAddr {
72
75
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
73
76
/// ```
74
77
#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
78
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "Ipv4Addr" ) ]
75
79
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
76
80
pub struct Ipv4Addr {
77
81
octets : [ u8 ; 4 ] ,
@@ -154,6 +158,7 @@ pub struct Ipv4Addr {
154
158
/// assert_eq!(localhost.is_loopback(), true);
155
159
/// ```
156
160
#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
161
+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "Ipv6Addr" ) ]
157
162
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
158
163
pub struct Ipv6Addr {
159
164
octets : [ u8 ; 16 ] ,
0 commit comments