Skip to content

Commit 6996376

Browse files
authored
Rollup merge of rust-lang#140976 - samueltardieu:diag-ipaddr-v4v6, r=Urgau
Add `Ipv4Addr` and `Ipv6Addr` diagnostic items They will be used in Clippy to detect runtime parsing of known-valid IP addresses.
2 parents b06f2ae + 7b1ba42 commit 6996376

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

compiler/rustc_span/src/symbol.rs

+2
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ symbols! {
280280
IoSeek,
281281
IoWrite,
282282
IpAddr,
283+
Ipv4Addr,
284+
Ipv6Addr,
283285
IrTyKind,
284286
Is,
285287
Item,

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)