Skip to content

Commit 07b3e2a

Browse files
committed
Add Ipv4Addr and Ipv6Addr diagnostic items
They will be used in Clippy to detect runtime parsing of known-valid IP addresses.
1 parent 414482f commit 07b3e2a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/core/src/net/ip_addr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub enum IpAddr {
6868
/// assert!("0000000.0.0.0".parse::<Ipv4Addr>().is_err()); // first octet is a zero in octal
6969
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
7070
/// ```
71+
#[rustc_diagnostic_item = "Ipv4Addr"]
7172
#[derive(Copy, Clone, PartialEq, Eq)]
7273
#[stable(feature = "rust1", since = "1.0.0")]
7374
pub struct Ipv4Addr {
@@ -160,6 +161,7 @@ impl Hash for Ipv4Addr {
160161
/// assert_eq!("::1".parse(), Ok(localhost));
161162
/// assert_eq!(localhost.is_loopback(), true);
162163
/// ```
164+
#[rustc_diagnostic_item = "Ipv6Addr"]
163165
#[derive(Copy, Clone, PartialEq, Eq)]
164166
#[stable(feature = "rust1", since = "1.0.0")]
165167
pub struct Ipv6Addr {

0 commit comments

Comments
 (0)