Skip to content

Commit ebaf512

Browse files
authored
Rollup merge of rust-lang#104252 - faern:stabilize-const_socketaddr, r=JohnTitor
Stabilize the const_socketaddr feature Stabilizes `#![feature(const_socketaddr)]`. Tracking issue: rust-lang#82485 Closes rust-lang#82485 This has been unstably const for over a year now. And the code change simplifying the constness of the `new` constructors has been in stable Rust since 1.64 (a bit over a full release cycle). I'm not aware of any blockers to this stabilization.
2 parents 18890f0 + 50f29d4 commit ebaf512

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@
358358
#![feature(const_ip)]
359359
#![feature(const_ipv4)]
360360
#![feature(const_ipv6)]
361-
#![feature(const_socketaddr)]
362361
#![feature(thread_local_internals)]
363362
//
364363
#![default_lib_allocator]

library/std/src/net/socket_addr.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl SocketAddr {
133133
/// ```
134134
#[stable(feature = "ip_addr", since = "1.7.0")]
135135
#[must_use]
136-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
136+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
137137
pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
138138
match ip {
139139
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
@@ -153,7 +153,7 @@ impl SocketAddr {
153153
/// ```
154154
#[must_use]
155155
#[stable(feature = "ip_addr", since = "1.7.0")]
156-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
156+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
157157
pub const fn ip(&self) -> IpAddr {
158158
match *self {
159159
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
@@ -194,7 +194,7 @@ impl SocketAddr {
194194
/// ```
195195
#[must_use]
196196
#[stable(feature = "rust1", since = "1.0.0")]
197-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
197+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
198198
pub const fn port(&self) -> u16 {
199199
match *self {
200200
SocketAddr::V4(ref a) => a.port(),
@@ -238,7 +238,7 @@ impl SocketAddr {
238238
/// ```
239239
#[must_use]
240240
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
241-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
241+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
242242
pub const fn is_ipv4(&self) -> bool {
243243
matches!(*self, SocketAddr::V4(_))
244244
}
@@ -260,7 +260,7 @@ impl SocketAddr {
260260
/// ```
261261
#[must_use]
262262
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
263-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
263+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
264264
pub const fn is_ipv6(&self) -> bool {
265265
matches!(*self, SocketAddr::V6(_))
266266
}
@@ -280,7 +280,7 @@ impl SocketAddrV4 {
280280
/// ```
281281
#[stable(feature = "rust1", since = "1.0.0")]
282282
#[must_use]
283-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
283+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
284284
pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
285285
SocketAddrV4 { ip, port }
286286
}
@@ -297,7 +297,7 @@ impl SocketAddrV4 {
297297
/// ```
298298
#[must_use]
299299
#[stable(feature = "rust1", since = "1.0.0")]
300-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
300+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
301301
pub const fn ip(&self) -> &Ipv4Addr {
302302
&self.ip
303303
}
@@ -330,7 +330,7 @@ impl SocketAddrV4 {
330330
/// ```
331331
#[must_use]
332332
#[stable(feature = "rust1", since = "1.0.0")]
333-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
333+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
334334
pub const fn port(&self) -> u16 {
335335
self.port
336336
}
@@ -371,7 +371,7 @@ impl SocketAddrV6 {
371371
/// ```
372372
#[stable(feature = "rust1", since = "1.0.0")]
373373
#[must_use]
374-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
374+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
375375
pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
376376
SocketAddrV6 { ip, port, flowinfo, scope_id }
377377
}
@@ -388,7 +388,7 @@ impl SocketAddrV6 {
388388
/// ```
389389
#[must_use]
390390
#[stable(feature = "rust1", since = "1.0.0")]
391-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
391+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
392392
pub const fn ip(&self) -> &Ipv6Addr {
393393
&self.ip
394394
}
@@ -421,7 +421,7 @@ impl SocketAddrV6 {
421421
/// ```
422422
#[must_use]
423423
#[stable(feature = "rust1", since = "1.0.0")]
424-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
424+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
425425
pub const fn port(&self) -> u16 {
426426
self.port
427427
}
@@ -464,7 +464,7 @@ impl SocketAddrV6 {
464464
/// ```
465465
#[must_use]
466466
#[stable(feature = "rust1", since = "1.0.0")]
467-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
467+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
468468
pub const fn flowinfo(&self) -> u32 {
469469
self.flowinfo
470470
}
@@ -504,7 +504,7 @@ impl SocketAddrV6 {
504504
/// ```
505505
#[must_use]
506506
#[stable(feature = "rust1", since = "1.0.0")]
507-
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
507+
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
508508
pub const fn scope_id(&self) -> u32 {
509509
self.scope_id
510510
}

0 commit comments

Comments
 (0)