Skip to content

Commit a6a7d21

Browse files
authored
Rollup merge of rust-lang#85672 - CDirkx:ip, r=Mark-Simulacrum
Move stability attribute for items under the `ip` feature The `#[unstable]` attribute for items under the `ip` feature is currently located on the `std::net::ip` module itself. This is unusual, and less readable. This has sidetracked discussion about these items numerous times (rust-lang#60145 (comment), rust-lang#76098 (comment), rust-lang#76098 (comment), rust-lang#75019 (comment), rust-lang#75019 (comment)) and lead to incorrect assumptions about which items are actually stable (rust-lang#60145 (comment), rust-lang#76098 (comment)). This PR moves the attribute from the module to the items themselves.
2 parents d75f0e5 + 87cf2d4 commit a6a7d21

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

library/std/src/net/ip.rs

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
#![unstable(
2-
feature = "ip",
3-
reason = "extra functionality has not been \
4-
scrutinized to the level that it should \
5-
be to be stable",
6-
issue = "27709"
7-
)]
8-
91
// Tests for this module
102
#[cfg(all(test, not(target_os = "emscripten")))]
113
mod tests;
@@ -126,6 +118,7 @@ pub struct Ipv6Addr {
126118

127119
#[allow(missing_docs)]
128120
#[derive(Copy, PartialEq, Eq, Clone, Hash, Debug)]
121+
#[unstable(feature = "ip", issue = "27709")]
129122
pub enum Ipv6MulticastScope {
130123
InterfaceLocal,
131124
LinkLocal,
@@ -199,6 +192,7 @@ impl IpAddr {
199192
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1)).is_global(), true);
200193
/// ```
201194
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
195+
#[unstable(feature = "ip", issue = "27709")]
202196
#[inline]
203197
pub const fn is_global(&self) -> bool {
204198
match self {
@@ -249,6 +243,7 @@ impl IpAddr {
249243
/// );
250244
/// ```
251245
#[rustc_const_unstable(feature = "const_ip", issue = "76205")]
246+
#[unstable(feature = "ip", issue = "27709")]
252247
#[inline]
253248
pub const fn is_documentation(&self) -> bool {
254249
match self {
@@ -549,6 +544,7 @@ impl Ipv4Addr {
549544
/// assert_eq!(Ipv4Addr::new(80, 9, 12, 3).is_global(), true);
550545
/// ```
551546
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
547+
#[unstable(feature = "ip", issue = "27709")]
552548
#[inline]
553549
pub const fn is_global(&self) -> bool {
554550
// check if this address is 192.0.0.9 or 192.0.0.10. These addresses are the only two
@@ -587,6 +583,7 @@ impl Ipv4Addr {
587583
/// assert_eq!(Ipv4Addr::new(100, 128, 0, 0).is_shared(), false);
588584
/// ```
589585
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
586+
#[unstable(feature = "ip", issue = "27709")]
590587
#[inline]
591588
pub const fn is_shared(&self) -> bool {
592589
self.octets()[0] == 100 && (self.octets()[1] & 0b1100_0000 == 0b0100_0000)
@@ -620,6 +617,7 @@ impl Ipv4Addr {
620617
/// assert_eq!(Ipv4Addr::new(191, 255, 255, 255).is_ietf_protocol_assignment(), false);
621618
/// ```
622619
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
620+
#[unstable(feature = "ip", issue = "27709")]
623621
#[inline]
624622
pub const fn is_ietf_protocol_assignment(&self) -> bool {
625623
self.octets()[0] == 192 && self.octets()[1] == 0 && self.octets()[2] == 0
@@ -644,6 +642,7 @@ impl Ipv4Addr {
644642
/// assert_eq!(Ipv4Addr::new(198, 20, 0, 0).is_benchmarking(), false);
645643
/// ```
646644
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
645+
#[unstable(feature = "ip", issue = "27709")]
647646
#[inline]
648647
pub const fn is_benchmarking(&self) -> bool {
649648
self.octets()[0] == 198 && (self.octets()[1] & 0xfe) == 18
@@ -677,6 +676,7 @@ impl Ipv4Addr {
677676
/// assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_reserved(), false);
678677
/// ```
679678
#[rustc_const_unstable(feature = "const_ipv4", issue = "76205")]
679+
#[unstable(feature = "ip", issue = "27709")]
680680
#[inline]
681681
pub const fn is_reserved(&self) -> bool {
682682
self.octets()[0] & 240 == 240 && !self.is_broadcast()
@@ -1234,6 +1234,7 @@ impl Ipv6Addr {
12341234
/// assert_eq!(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1).is_global(), true);
12351235
/// ```
12361236
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1237+
#[unstable(feature = "ip", issue = "27709")]
12371238
#[inline]
12381239
pub const fn is_global(&self) -> bool {
12391240
match self.multicast_scope() {
@@ -1260,6 +1261,7 @@ impl Ipv6Addr {
12601261
/// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 0).is_unique_local(), true);
12611262
/// ```
12621263
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1264+
#[unstable(feature = "ip", issue = "27709")]
12631265
#[inline]
12641266
pub const fn is_unique_local(&self) -> bool {
12651267
(self.segments()[0] & 0xfe00) == 0xfc00
@@ -1315,6 +1317,7 @@ impl Ipv6Addr {
13151317
/// [IETF RFC 4291 section 2.5.6]: https://tools.ietf.org/html/rfc4291#section-2.5.6
13161318
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
13171319
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1320+
#[unstable(feature = "ip", issue = "27709")]
13181321
#[inline]
13191322
pub const fn is_unicast_link_local_strict(&self) -> bool {
13201323
matches!(self.segments(), [0xfe80, 0, 0, 0, ..])
@@ -1369,6 +1372,7 @@ impl Ipv6Addr {
13691372
/// [IETF RFC 4291 section 2.4]: https://tools.ietf.org/html/rfc4291#section-2.4
13701373
/// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406
13711374
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1375+
#[unstable(feature = "ip", issue = "27709")]
13721376
#[inline]
13731377
pub const fn is_unicast_link_local(&self) -> bool {
13741378
(self.segments()[0] & 0xffc0) == 0xfe80
@@ -1409,6 +1413,7 @@ impl Ipv6Addr {
14091413
///
14101414
/// [RFC 3879]: https://tools.ietf.org/html/rfc3879
14111415
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1416+
#[unstable(feature = "ip", issue = "27709")]
14121417
#[inline]
14131418
pub const fn is_unicast_site_local(&self) -> bool {
14141419
(self.segments()[0] & 0xffc0) == 0xfec0
@@ -1432,6 +1437,7 @@ impl Ipv6Addr {
14321437
/// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).is_documentation(), true);
14331438
/// ```
14341439
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1440+
#[unstable(feature = "ip", issue = "27709")]
14351441
#[inline]
14361442
pub const fn is_documentation(&self) -> bool {
14371443
(self.segments()[0] == 0x2001) && (self.segments()[1] == 0xdb8)
@@ -1468,6 +1474,7 @@ impl Ipv6Addr {
14681474
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_unicast_global(), true);
14691475
/// ```
14701476
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1477+
#[unstable(feature = "ip", issue = "27709")]
14711478
#[inline]
14721479
pub const fn is_unicast_global(&self) -> bool {
14731480
!self.is_multicast()
@@ -1494,6 +1501,7 @@ impl Ipv6Addr {
14941501
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).multicast_scope(), None);
14951502
/// ```
14961503
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1504+
#[unstable(feature = "ip", issue = "27709")]
14971505
#[inline]
14981506
pub const fn multicast_scope(&self) -> Option<Ipv6MulticastScope> {
14991507
if self.is_multicast() {
@@ -1555,6 +1563,7 @@ impl Ipv6Addr {
15551563
/// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1).to_ipv4_mapped(), None);
15561564
/// ```
15571565
#[rustc_const_unstable(feature = "const_ipv6", issue = "76205")]
1566+
#[unstable(feature = "ip", issue = "27709")]
15581567
#[inline]
15591568
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
15601569
match self.octets() {

0 commit comments

Comments
 (0)