Add rustc_diagnostic_item
for IP addresses.
This commit is contained in:
parent
f7e8ba28a4
commit
d01498a902
@ -29,13 +29,16 @@ use super::display_buffer::DisplayBuffer;
|
||||
/// assert_eq!(localhost_v4.is_ipv6(), false);
|
||||
/// assert_eq!(localhost_v4.is_ipv4(), true);
|
||||
/// ```
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "IpAddr")]
|
||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
|
||||
pub enum IpAddr {
|
||||
/// An IPv4 address.
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "ip_addr_variant_v4")]
|
||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||
V4(#[stable(feature = "ip_addr", since = "1.7.0")] Ipv4Addr),
|
||||
/// An IPv6 address.
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "ip_addr_variant_v6")]
|
||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||
V6(#[stable(feature = "ip_addr", since = "1.7.0")] Ipv6Addr),
|
||||
}
|
||||
@ -72,6 +75,7 @@ pub enum IpAddr {
|
||||
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
|
||||
/// ```
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "Ipv4Addr")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Ipv4Addr {
|
||||
octets: [u8; 4],
|
||||
@ -154,6 +158,7 @@ pub struct Ipv4Addr {
|
||||
/// assert_eq!(localhost.is_loopback(), true);
|
||||
/// ```
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "Ipv6Addr")]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub struct Ipv6Addr {
|
||||
octets: [u8; 16],
|
||||
|
Loading…
x
Reference in New Issue
Block a user