Content-Length: 501241 | pFad | https://github.com/model-checking/verify-rust-std/commit/385e1b875129c61506f7abb5e7090225bb425cd7

EB Rollup merge of #125551 - clarfonthey:ip-bits, r=jhpratt · model-checking/verify-rust-std@385e1b8 · GitHub
Skip to content

Commit 385e1b8

Browse files
Rollup merge of rust-lang#125551 - clarfonthey:ip-bits, r=jhpratt
Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`) This completed FCP in rust-lang#113744. (Closes rust-lang#113744.) Stabilises the following APIs: ```rust impl Ipv4Addr { pub const BITS: u32 = 32; pub const fn from_bits(bits: u32) -> Ipv4Addr; pub const fn to_bits(self) -> u32; } impl Ipv6Addr { pub const BITS: u32 = 128; pub const fn from_bits(bits: u128) -> Ipv4Addr; pub const fn to_bits(self) -> u128; } ```
2 parents 893db81 + b1ac7da commit 385e1b8

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

core/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
#![feature(duration_consts_float)]
175175
#![feature(internal_impls_macro)]
176176
#![feature(ip)]
177-
#![feature(ip_bits)]
178177
#![feature(is_ascii_octdigit)]
179178
#![feature(isqrt)]
180179
#![feature(link_cfg)]

core/src/net/ip_addr.rs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,11 @@ impl Ipv4Addr {
460460
//github.com/ # Examples
461461
//github.com/
462462
//github.com/ ```
463-
//github.com/ #![feature(ip_bits)]
464463
//github.com/ use std::net::Ipv4Addr;
465464
//github.com/
466465
//github.com/ assert_eq!(Ipv4Addr::BITS, 32);
467466
//github.com/ ```
468-
#[unstable(feature = "ip_bits", issue = "113744")]
467+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
469468
pub const BITS: u32 = 32;
470469

471470
//github.com/ Converts an IPv4 address into a `u32` representation using native byte order.
@@ -479,24 +478,22 @@ impl Ipv4Addr {
479478
//github.com/ # Examples
480479
//github.com/
481480
//github.com/ ```
482-
//github.com/ #![feature(ip_bits)]
483481
//github.com/ use std::net::Ipv4Addr;
484482
//github.com/
485483
//github.com/ let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
486484
//github.com/ assert_eq!(0x12345678, addr.to_bits());
487485
//github.com/ ```
488486
//github.com/
489487
//github.com/ ```
490-
//github.com/ #![feature(ip_bits)]
491488
//github.com/ use std::net::Ipv4Addr;
492489
//github.com/
493490
//github.com/ let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
494491
//github.com/ let addr_bits = addr.to_bits() & 0xffffff00;
495492
//github.com/ assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x00), Ipv4Addr::from_bits(addr_bits));
496493
//github.com/
497494
//github.com/ ```
498-
#[rustc_const_unstable(feature = "ip_bits", issue = "113744")]
499-
#[unstable(feature = "ip_bits", issue = "113744")]
495+
#[rustc_const_stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
496+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
500497
#[must_use]
501498
#[inline]
502499
pub const fn to_bits(self) -> u32 {
@@ -510,14 +507,13 @@ impl Ipv4Addr {
510507
//github.com/ # Examples
511508
//github.com/
512509
//github.com/ ```
513-
//github.com/ #![feature(ip_bits)]
514510
//github.com/ use std::net::Ipv4Addr;
515511
//github.com/
516512
//github.com/ let addr = Ipv4Addr::from(0x12345678);
517513
//github.com/ assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x78), addr);
518514
//github.com/ ```
519-
#[rustc_const_unstable(feature = "ip_bits", issue = "113744")]
520-
#[unstable(feature = "ip_bits", issue = "113744")]
515+
#[rustc_const_stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
516+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
521517
#[must_use]
522518
#[inline]
523519
pub const fn from_bits(bits: u32) -> Ipv4Addr {
@@ -1238,12 +1234,11 @@ impl Ipv6Addr {
12381234
//github.com/ # Examples
12391235
//github.com/
12401236
//github.com/ ```
1241-
//github.com/ #![feature(ip_bits)]
12421237
//github.com/ use std::net::Ipv6Addr;
12431238
//github.com/
12441239
//github.com/ assert_eq!(Ipv6Addr::BITS, 128);
12451240
//github.com/ ```
1246-
#[unstable(feature = "ip_bits", issue = "113744")]
1241+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
12471242
pub const BITS: u32 = 128;
12481243

12491244
//github.com/ Converts an IPv6 address into a `u128` representation using native byte order.
@@ -1257,7 +1252,6 @@ impl Ipv6Addr {
12571252
//github.com/ # Examples
12581253
//github.com/
12591254
//github.com/ ```
1260-
//github.com/ #![feature(ip_bits)]
12611255
//github.com/ use std::net::Ipv6Addr;
12621256
//github.com/
12631257
//github.com/ let addr = Ipv6Addr::new(
@@ -1268,7 +1262,6 @@ impl Ipv6Addr {
12681262
//github.com/ ```
12691263
//github.com/
12701264
//github.com/ ```
1271-
//github.com/ #![feature(ip_bits)]
12721265
//github.com/ use std::net::Ipv6Addr;
12731266
//github.com/
12741267
//github.com/ let addr = Ipv6Addr::new(
@@ -1284,8 +1277,8 @@ impl Ipv6Addr {
12841277
//github.com/ Ipv6Addr::from_bits(addr_bits));
12851278
//github.com/
12861279
//github.com/ ```
1287-
#[rustc_const_unstable(feature = "ip_bits", issue = "113744")]
1288-
#[unstable(feature = "ip_bits", issue = "113744")]
1280+
#[rustc_const_stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
1281+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
12891282
#[must_use]
12901283
#[inline]
12911284
pub const fn to_bits(self) -> u128 {
@@ -1299,7 +1292,6 @@ impl Ipv6Addr {
12991292
//github.com/ # Examples
13001293
//github.com/
13011294
//github.com/ ```
1302-
//github.com/ #![feature(ip_bits)]
13031295
//github.com/ use std::net::Ipv6Addr;
13041296
//github.com/
13051297
//github.com/ let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128);
@@ -1310,8 +1302,8 @@ impl Ipv6Addr {
13101302
//github.com/ ),
13111303
//github.com/ addr);
13121304
//github.com/ ```
1313-
#[rustc_const_unstable(feature = "ip_bits", issue = "113744")]
1314-
#[unstable(feature = "ip_bits", issue = "113744")]
1305+
#[rustc_const_stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
1306+
#[stable(feature = "ip_bits", since = "CURRENT_RUSTC_VERSION")]
13151307
#[must_use]
13161308
#[inline]
13171309
pub const fn from_bits(bits: u128) -> Ipv6Addr {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/model-checking/verify-rust-std/commit/385e1b875129c61506f7abb5e7090225bb425cd7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy