@@ -29,13 +29,16 @@ use super::display_buffer::DisplayBuffer;
2929/// assert_eq!(localhost_v4.is_ipv6(), false);
3030/// assert_eq!(localhost_v4.is_ipv4(), true);
3131/// ```
32+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "IpAddr" ) ]
3233#[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
3334#[ derive( Copy , Clone , Eq , PartialEq , Hash , PartialOrd , Ord ) ]
3435pub enum IpAddr {
3536 /// An IPv4 address.
37+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "ip_addr_variant_v4" ) ]
3638 #[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
3739 V4 ( #[ stable( feature = "ip_addr" , since = "1.7.0" ) ] Ipv4Addr ) ,
3840 /// An IPv6 address.
41+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "ip_addr_variant_v6" ) ]
3942 #[ stable( feature = "ip_addr" , since = "1.7.0" ) ]
4043 V6 ( #[ stable( feature = "ip_addr" , since = "1.7.0" ) ] Ipv6Addr ) ,
4144}
@@ -72,6 +75,7 @@ pub enum IpAddr {
7275/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
7376/// ```
7477#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
78+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "Ipv4Addr" ) ]
7579#[ stable( feature = "rust1" , since = "1.0.0" ) ]
7680pub struct Ipv4Addr {
7781 octets : [ u8 ; 4 ] ,
@@ -154,6 +158,7 @@ pub struct Ipv4Addr {
154158/// assert_eq!(localhost.is_loopback(), true);
155159/// ```
156160#[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
161+ #[ cfg_attr( not( test) , rustc_diagnostic_item = "Ipv6Addr" ) ]
157162#[ stable( feature = "rust1" , since = "1.0.0" ) ]
158163pub struct Ipv6Addr {
159164 octets : [ u8 ; 16 ] ,
0 commit comments