Skip to content

Commit ee9e48b

Browse files
author
CDirkx
committed
Make methods unstable const under const_ipv4
1 parent fbb3673 commit ee9e48b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
#![feature(const_cstr_unchecked)]
240240
#![feature(const_fn_transmute)]
241241
#![feature(const_raw_ptr_deref)]
242+
#![feature(const_ipv4)]
242243
#![feature(container_error_extra)]
243244
#![feature(core_intrinsics)]
244245
#![feature(custom_test_frameworks)]

library/std/src/net/ip.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl Ipv4Addr {
361361
/// let addr = Ipv4Addr::new(127, 0, 0, 1);
362362
/// assert_eq!(addr.octets(), [127, 0, 0, 1]);
363363
/// ```
364-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
364+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
365365
#[stable(feature = "rust1", since = "1.0.0")]
366366
pub const fn octets(&self) -> [u8; 4] {
367367
// This returns the order we want because s_addr is stored in big-endian.
@@ -405,7 +405,7 @@ impl Ipv4Addr {
405405
/// assert_eq!(Ipv4Addr::new(127, 0, 0, 1).is_loopback(), true);
406406
/// assert_eq!(Ipv4Addr::new(45, 22, 13, 197).is_loopback(), false);
407407
/// ```
408-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
408+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
409409
#[stable(since = "1.7.0", feature = "ip_17")]
410410
pub const fn is_loopback(&self) -> bool {
411411
self.octets()[0] == 127
@@ -435,7 +435,7 @@ impl Ipv4Addr {
435435
/// assert_eq!(Ipv4Addr::new(192, 168, 0, 2).is_private(), true);
436436
/// assert_eq!(Ipv4Addr::new(192, 169, 0, 2).is_private(), false);
437437
/// ```
438-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
438+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
439439
#[stable(since = "1.7.0", feature = "ip_17")]
440440
pub const fn is_private(&self) -> bool {
441441
match self.octets() {
@@ -462,7 +462,7 @@ impl Ipv4Addr {
462462
/// assert_eq!(Ipv4Addr::new(169, 254, 10, 65).is_link_local(), true);
463463
/// assert_eq!(Ipv4Addr::new(16, 89, 10, 65).is_link_local(), false);
464464
/// ```
465-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
465+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
466466
#[stable(since = "1.7.0", feature = "ip_17")]
467467
pub const fn is_link_local(&self) -> bool {
468468
match self.octets() {
@@ -577,7 +577,7 @@ impl Ipv4Addr {
577577
/// assert_eq!(Ipv4Addr::new(100, 127, 255, 255).is_shared(), true);
578578
/// assert_eq!(Ipv4Addr::new(100, 128, 0, 0).is_shared(), false);
579579
/// ```
580-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
580+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
581581
pub const fn is_shared(&self) -> bool {
582582
self.octets()[0] == 100 && (self.octets()[1] & 0b1100_0000 == 0b0100_0000)
583583
}
@@ -610,7 +610,7 @@ impl Ipv4Addr {
610610
/// assert_eq!(Ipv4Addr::new(192, 0, 1, 0).is_ietf_protocol_assignment(), false);
611611
/// assert_eq!(Ipv4Addr::new(191, 255, 255, 255).is_ietf_protocol_assignment(), false);
612612
/// ```
613-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
613+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
614614
pub const fn is_ietf_protocol_assignment(&self) -> bool {
615615
self.octets()[0] == 192 && self.octets()[1] == 0 && self.octets()[2] == 0
616616
}
@@ -634,7 +634,7 @@ impl Ipv4Addr {
634634
/// assert_eq!(Ipv4Addr::new(198, 19, 255, 255).is_benchmarking(), true);
635635
/// assert_eq!(Ipv4Addr::new(198, 20, 0, 0).is_benchmarking(), false);
636636
/// ```
637-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
637+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
638638
pub const fn is_benchmarking(&self) -> bool {
639639
self.octets()[0] == 198 && (self.octets()[1] & 0xfe) == 18
640640
}
@@ -688,7 +688,7 @@ impl Ipv4Addr {
688688
/// assert_eq!(Ipv4Addr::new(236, 168, 10, 65).is_multicast(), true);
689689
/// assert_eq!(Ipv4Addr::new(172, 16, 10, 65).is_multicast(), false);
690690
/// ```
691-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
691+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
692692
#[stable(since = "1.7.0", feature = "ip_17")]
693693
pub const fn is_multicast(&self) -> bool {
694694
self.octets()[0] >= 224 && self.octets()[0] <= 239
@@ -735,7 +735,7 @@ impl Ipv4Addr {
735735
/// assert_eq!(Ipv4Addr::new(203, 0, 113, 6).is_documentation(), true);
736736
/// assert_eq!(Ipv4Addr::new(193, 34, 17, 19).is_documentation(), false);
737737
/// ```
738-
#[rustc_const_stable(feature = "const_ipv4", since = "1.48.0")]
738+
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
739739
#[stable(since = "1.7.0", feature = "ip_17")]
740740
pub const fn is_documentation(&self) -> bool {
741741
match self.octets() {

0 commit comments

Comments
 (0)