Auto merge of #131672 - matthiaskrgr:rollup-gyzysj4, r=matthiaskrgr · qinheping/verify-rust-std@843c9e9 (original) (raw)

`@@ -295,7 +295,6 @@ impl IpAddr {

`

295

295

`/// assert_eq!(IpAddr::V4(Ipv4Addr::new(80, 9, 12, 3)).is_global(), true);

`

296

296

`/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1)).is_global(), true);

`

297

297

```` /// ```


`298`

``

`-

#[rustc_const_unstable(feature = "const_ip", issue = "76205")]

`

`299`

`298`

`#[unstable(feature = "ip", issue = "27709")]

`

`300`

`299`

`#[must_use]

`

`301`

`300`

`#[inline]

`

`@@ -348,7 +347,6 @@ impl IpAddr {

`

`348`

`347`

`/// true

`

`349`

`348`

`/// );

`

`350`

`349`

```` /// ```

351

``

`-

#[rustc_const_unstable(feature = "const_ip", issue = "76205")]

`

352

350

`#[unstable(feature = "ip", issue = "27709")]

`

353

351

`#[must_use]

`

354

352

`#[inline]

`

`@@ -600,6 +598,24 @@ impl Ipv4Addr {

`

600

598

`self.octets

`

601

599

`}

`

602

600

``

``

601

`` +

/// Creates an Ipv4Addr from a four element byte array.

``

``

602

`+

///

`

``

603

`+

/// # Examples

`

``

604

`+

///

`

``

605


/// ```

``

606

`+

/// #![feature(ip_from)]

`

``

607

`+

/// use std:🥅:Ipv4Addr;

`

``

608

`+

///

`

``

609

`+

/// let addr = Ipv4Addr::from_octets([13u8, 12u8, 11u8, 10u8]);

`

``

610

`+

/// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);

`

``

611


/// ```

``

612

`+

#[unstable(feature = "ip_from", issue = "131360")]

`

``

613

`+

#[must_use]

`

``

614

`+

#[inline]

`

``

615

`+

pub const fn from_octets(octets: [u8; 4]) -> Ipv4Addr {

`

``

616

`+

Ipv4Addr { octets }

`

``

617

`+

}

`

``

618

+

603

619

`` /// Returns [true] for the special 'unspecified' address (0.0.0.0).

``

604

620

`///

`

605

621

`/// This property is defined in UNIX Network Programming, Second Edition,

`

`@@ -776,7 +792,6 @@ impl Ipv4Addr {

`

776

792

`///

`

777

793

`/// // For a complete overview see the IANA IPv4 Special-Purpose Address Registry.

`

778

794

```` /// ```


`779`

``

`-

#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]

`

`780`

`795`

`#[unstable(feature = "ip", issue = "27709")]

`

`781`

`796`

`#[must_use]

`

`782`

`797`

`#[inline]

`

`@@ -813,7 +828,6 @@ impl Ipv4Addr {

`

`813`

`828`

`/// assert_eq!(Ipv4Addr::new(100, 127, 255, 255).is_shared(), true);

`

`814`

`829`

`/// assert_eq!(Ipv4Addr::new(100, 128, 0, 0).is_shared(), false);

`

`815`

`830`

```` /// ```

816

``

`-

#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]

`

817

831

`#[unstable(feature = "ip", issue = "27709")]

`

818

832

`#[must_use]

`

819

833

`#[inline]

`

`@@ -841,7 +855,6 @@ impl Ipv4Addr {

`

841

855

`/// assert_eq!(Ipv4Addr::new(198, 19, 255, 255).is_benchmarking(), true);

`

842

856

`/// assert_eq!(Ipv4Addr::new(198, 20, 0, 0).is_benchmarking(), false);

`

843

857

```` /// ```


`844`

``

`-

#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]

`

`845`

`858`

`#[unstable(feature = "ip", issue = "27709")]

`

`846`

`859`

`#[must_use]

`

`847`

`860`

`#[inline]

`

`@@ -878,7 +891,6 @@ impl Ipv4Addr {

`

`878`

`891`

`/// // The broadcast address is not considered as reserved for future use by this implementation

`

`879`

`892`

`/// assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_reserved(), false);

`

`880`

`893`

```` /// ```

881

``

`-

#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]

`

882

894

`#[unstable(feature = "ip", issue = "27709")]

`

883

895

`#[must_use]

`

884

896

`#[inline]

`

`@@ -1400,6 +1412,34 @@ impl Ipv6Addr {

`

1400

1412

`]

`

1401

1413

`}

`

1402

1414

``

``

1415

`` +

/// Creates an Ipv6Addr from an eight element 16-bit array.

``

``

1416

`+

///

`

``

1417

`+

/// # Examples

`

``

1418

`+

///

`

``

1419


/// ```

``

1420

`+

/// #![feature(ip_from)]

`

``

1421

`+

/// use std:🥅:Ipv6Addr;

`

``

1422

`+

///

`

``

1423

`+

/// let addr = Ipv6Addr::from_segments([

`

``

1424

`+

/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,

`

``

1425

`+

/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,

`

``

1426

`+

/// ]);

`

``

1427

`+

/// assert_eq!(

`

``

1428

`+

/// Ipv6Addr::new(

`

``

1429

`+

/// 0x20d, 0x20c, 0x20b, 0x20a,

`

``

1430

`+

/// 0x209, 0x208, 0x207, 0x206,

`

``

1431

`+

/// ),

`

``

1432

`+

/// addr

`

``

1433

`+

/// );

`

``

1434


/// ```

``

1435

`+

#[unstable(feature = "ip_from", issue = "131360")]

`

``

1436

`+

#[must_use]

`

``

1437

`+

#[inline]

`

``

1438

`+

pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr {

`

``

1439

`+

let [a, b, c, d, e, f, g, h] = segments;

`

``

1440

`+

Ipv6Addr::new(a, b, c, d, e, f, g, h)

`

``

1441

`+

}

`

``

1442

+

1403

1443

`` /// Returns [true] for the special 'unspecified' address (::).

``

1404

1444

`///

`

1405

1445

`/// This property is defined in [IETF RFC 4291].

`

`@@ -1510,7 +1550,6 @@ impl Ipv6Addr {

`

1510

1550

`///

`

1511

1551

`/// // For a complete overview see the IANA IPv6 Special-Purpose Address Registry.

`

1512

1552

```` /// ```


`1513`

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

`1514`

`1553`

`#[unstable(feature = "ip", issue = "27709")]

`

`1515`

`1554`

`#[must_use]

`

`1516`

`1555`

`#[inline]

`

`@@ -1562,7 +1601,6 @@ impl Ipv6Addr {

`

`1562`

`1601`

`/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_unique_local(), false);

`

`1563`

`1602`

`/// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 0).is_unique_local(), true);

`

`1564`

`1603`

```` /// ```

1565

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

1566

1604

`#[unstable(feature = "ip", issue = "27709")]

`

1567

1605

`#[must_use]

`

1568

1606

`#[inline]

`

`@@ -1591,7 +1629,6 @@ impl Ipv6Addr {

`

1591

1629

`/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_unicast(), true);

`

1592

1630

`/// assert_eq!(Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0).is_unicast(), false);

`

1593

1631

```` /// ```


`1594`

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

`1595`

`1632`

`#[unstable(feature = "ip", issue = "27709")]

`

`1596`

`1633`

`#[must_use]

`

`1597`

`1634`

`#[inline]

`

`@@ -1643,7 +1680,6 @@ impl Ipv6Addr {

`

`1643`

`1680`

`/// assert_eq!(Ipv6Addr::new(0xfe80, 0, 0, 1, 0, 0, 0, 0).is_unicast_link_local(), true);

`

`1644`

`1681`

`/// assert_eq!(Ipv6Addr::new(0xfe81, 0, 0, 0, 0, 0, 0, 0).is_unicast_link_local(), true);

`

`1645`

`1682`

```` /// ```

1646

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

1647

1683

`#[unstable(feature = "ip", issue = "27709")]

`

1648

1684

`#[must_use]

`

1649

1685

`#[inline]

`

`@@ -1668,7 +1704,6 @@ impl Ipv6Addr {

`

1668

1704

`/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_documentation(), false);

`

1669

1705

`/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_documentation(), true);

`

1670

1706

```` /// ```


`1671`

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

`1672`

`1707`

`#[unstable(feature = "ip", issue = "27709")]

`

`1673`

`1708`

`#[must_use]

`

`1674`

`1709`

`#[inline]

`

`@@ -1729,7 +1764,6 @@ impl Ipv6Addr {

`

`1729`

`1764`

`/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_unicast_global(), false);

`

`1730`

`1765`

`/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_unicast_global(), true);

`

`1731`

`1766`

```` /// ```

1732

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

1733

1767

`#[unstable(feature = "ip", issue = "27709")]

`

1734

1768

`#[must_use]

`

1735

1769

`#[inline]

`

`@@ -1758,7 +1792,6 @@ impl Ipv6Addr {

`

1758

1792

`/// );

`

1759

1793

`/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).multicast_scope(), None);

`

1760

1794

```` /// ```


`1761`

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

`1762`

`1795`

`#[unstable(feature = "ip", issue = "27709")]

`

`1763`

`1796`

`#[must_use]

`

`1764`

`1797`

`#[inline]

`

`@@ -1818,7 +1851,6 @@ impl Ipv6Addr {

`

`1818`

`1851`

`///

`

`1819`

`1852`

`/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_ipv4_mapped(), false);

`

`1820`

`1853`

```` /// ```

1821

``

`-

#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]

`

1822

1854

`#[unstable(feature = "ip", issue = "27709")]

`

1823

1855

`#[must_use]

`

1824

1856

`#[inline]

`

`@@ -1932,7 +1964,7 @@ impl Ipv6Addr {

`

1932

1964

`/// use std:🥅:Ipv6Addr;

`

1933

1965

`///

`

1934

1966

`/// assert_eq!(Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0).octets(),

`

1935

``

`-

/// [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

`

``

1967

`+

/// [0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

`

1936

1968

```` /// ```


`1937`

`1969`

`#[rustc_const_stable(feature = "const_ip_32", since = "1.32.0")]

`

`1938`

`1970`

`#[stable(feature = "ipv6_to_octets", since = "1.12.0")]

`

`@@ -1941,6 +1973,33 @@ impl Ipv6Addr {

`

`1941`

`1973`

`pub const fn octets(&self) -> [u8; 16] {

`

`1942`

`1974`

`self.octets

`

`1943`

`1975`

`}

`

``

`1976`

`+`

``

`1977`

`` +

/// Creates an `Ipv6Addr` from a sixteen element byte array.

``

``

`1978`

`+

///

`

``

`1979`

`+

/// # Examples

`

``

`1980`

`+

///

`

``

`1981`

```` +

/// ```

``

1982

`+

/// #![feature(ip_from)]

`

``

1983

`+

/// use std:🥅:Ipv6Addr;

`

``

1984

`+

///

`

``

1985

`+

/// let addr = Ipv6Addr::from_octets([

`

``

1986

`+

/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,

`

``

1987

`+

/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,

`

``

1988

`+

/// ]);

`

``

1989

`+

/// assert_eq!(

`

``

1990

`+

/// Ipv6Addr::new(

`

``

1991

`+

/// 0x1918, 0x1716, 0x1514, 0x1312,

`

``

1992

`+

/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,

`

``

1993

`+

/// ),

`

``

1994

`+

/// addr

`

``

1995

`+

/// );

`

``

1996


/// ```

``

1997

`+

#[unstable(feature = "ip_from", issue = "131360")]

`

``

1998

`+

#[must_use]

`

``

1999

`+

#[inline]

`

``

2000

`+

pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr {

`

``

2001

`+

Ipv6Addr { octets }

`

``

2002

`+

}

`

1944

2003

`}

`

1945

2004

``

1946

2005

`/// Writes an Ipv6Addr, conforming to the canonical style described by

`

`@@ -2113,15 +2172,13 @@ impl From<[u8; 16]> for Ipv6Addr {

`

2113

2172

`/// use std:🥅:Ipv6Addr;

`

2114

2173

`///

`

2115

2174

`/// let addr = Ipv6Addr::from([

`

2116

``

`-

/// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,

`

2117

``

`-

/// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,

`

``

2175

`+

/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,

`

``

2176

`+

/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,

`

2118

2177

`/// ]);

`

2119

2178

`/// assert_eq!(

`

2120

2179

`/// Ipv6Addr::new(

`

2121

``

`-

/// 0x1918, 0x1716,

`

2122

``

`-

/// 0x1514, 0x1312,

`

2123

``

`-

/// 0x1110, 0x0f0e,

`

2124

``

`-

/// 0x0d0c, 0x0b0a

`

``

2180

`+

/// 0x1918, 0x1716, 0x1514, 0x1312,

`

``

2181

`+

/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,

`

2125

2182

`/// ),

`

2126

2183

`/// addr

`

2127

2184

`/// );

`

`@@ -2142,15 +2199,13 @@ impl From<[u16; 8]> for Ipv6Addr {

`

2142

2199

`/// use std:🥅:Ipv6Addr;

`

2143

2200

`///

`

2144

2201

`/// let addr = Ipv6Addr::from([

`

2145

``

`-

/// 525u16, 524u16, 523u16, 522u16,

`

2146

``

`-

/// 521u16, 520u16, 519u16, 518u16,

`

``

2202

`+

/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,

`

``

2203

`+

/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,

`

2147

2204

`/// ]);

`

2148

2205

`/// assert_eq!(

`

2149

2206

`/// Ipv6Addr::new(

`

2150

``

`-

/// 0x20d, 0x20c,

`

2151

``

`-

/// 0x20b, 0x20a,

`

2152

``

`-

/// 0x209, 0x208,

`

2153

``

`-

/// 0x207, 0x206

`

``

2207

`+

/// 0x20d, 0x20c, 0x20b, 0x20a,

`

``

2208

`+

/// 0x209, 0x208, 0x207, 0x206,

`

2154

2209

`/// ),

`

2155

2210

`/// addr

`

2156

2211

`/// );

`

`@@ -2172,15 +2227,13 @@ impl From<[u8; 16]> for IpAddr {

`

2172

2227

`/// use std:🥅:{IpAddr, Ipv6Addr};

`

2173

2228

`///

`

2174

2229

`/// let addr = IpAddr::from([

`

2175

``

`-

/// 25u8, 24u8, 23u8, 22u8, 21u8, 20u8, 19u8, 18u8,

`

2176

``

`-

/// 17u8, 16u8, 15u8, 14u8, 13u8, 12u8, 11u8, 10u8,

`

``

2230

`+

/// 0x19u8, 0x18u8, 0x17u8, 0x16u8, 0x15u8, 0x14u8, 0x13u8, 0x12u8,

`

``

2231

`+

/// 0x11u8, 0x10u8, 0x0fu8, 0x0eu8, 0x0du8, 0x0cu8, 0x0bu8, 0x0au8,

`

2177

2232

`/// ]);

`

2178

2233

`/// assert_eq!(

`

2179

2234

`/// IpAddr::V6(Ipv6Addr::new(

`

2180

``

`-

/// 0x1918, 0x1716,

`

2181

``

`-

/// 0x1514, 0x1312,

`

2182

``

`-

/// 0x1110, 0x0f0e,

`

2183

``

`-

/// 0x0d0c, 0x0b0a

`

``

2235

`+

/// 0x1918, 0x1716, 0x1514, 0x1312,

`

``

2236

`+

/// 0x1110, 0x0f0e, 0x0d0c, 0x0b0a,

`

2184

2237

`/// )),

`

2185

2238

`/// addr

`

2186

2239

`/// );

`

`@@ -2201,15 +2254,13 @@ impl From<[u16; 8]> for IpAddr {

`

2201

2254

`/// use std:🥅:{IpAddr, Ipv6Addr};

`

2202

2255

`///

`

2203

2256

`/// let addr = IpAddr::from([

`

2204

``

`-

/// 525u16, 524u16, 523u16, 522u16,

`

2205

``

`-

/// 521u16, 520u16, 519u16, 518u16,

`

``

2257

`+

/// 0x20du16, 0x20cu16, 0x20bu16, 0x20au16,

`

``

2258

`+

/// 0x209u16, 0x208u16, 0x207u16, 0x206u16,

`

2206

2259

`/// ]);

`

2207

2260

`/// assert_eq!(

`

2208

2261

`/// IpAddr::V6(Ipv6Addr::new(

`

2209

``

`-

/// 0x20d, 0x20c,

`

2210

``

`-

/// 0x20b, 0x20a,

`

2211

``

`-

/// 0x209, 0x208,

`

2212

``

`-

/// 0x207, 0x206

`

``

2262

`+

/// 0x20d, 0x20c, 0x20b, 0x20a,

`

``

2263

`+

/// 0x209, 0x208, 0x207, 0x206,

`

2213

2264

`/// )),

`

2214

2265

`/// addr

`

2215

2266

`/// );

`