Rollup merge of #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.
This commit is contained in:
Matthias Krüger 2025-05-14 18:43:39 +02:00 committed by GitHub
commit a1b5841bcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View file

@ -280,6 +280,8 @@ symbols! {
IoSeek,
IoWrite,
IpAddr,
Ipv4Addr,
Ipv6Addr,
IrTyKind,
Is,
Item,

View file

@ -68,6 +68,7 @@ pub enum IpAddr {
/// assert!("0000000.0.0.0".parse::<Ipv4Addr>().is_err()); // first octet is a zero in octal
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
/// ```
#[rustc_diagnostic_item = "Ipv4Addr"]
#[derive(Copy, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv4Addr {
@ -160,6 +161,7 @@ impl Hash for Ipv4Addr {
/// assert_eq!("::1".parse(), Ok(localhost));
/// assert_eq!(localhost.is_loopback(), true);
/// ```
#[rustc_diagnostic_item = "Ipv6Addr"]
#[derive(Copy, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Ipv6Addr {