mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Stabilize the const_socketaddr feature
This commit is contained in:
parent
027c8507b4
commit
50f29d48bd
@ -358,7 +358,6 @@
|
||||
#![feature(const_ip)]
|
||||
#![feature(const_ipv4)]
|
||||
#![feature(const_ipv6)]
|
||||
#![feature(const_socketaddr)]
|
||||
#![feature(thread_local_internals)]
|
||||
//
|
||||
#![default_lib_allocator]
|
||||
|
@ -133,7 +133,7 @@ impl SocketAddr {
|
||||
/// ```
|
||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||
#[must_use]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
|
||||
match ip {
|
||||
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
|
||||
@ -153,7 +153,7 @@ impl SocketAddr {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "ip_addr", since = "1.7.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn ip(&self) -> IpAddr {
|
||||
match *self {
|
||||
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
|
||||
@ -194,7 +194,7 @@ impl SocketAddr {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn port(&self) -> u16 {
|
||||
match *self {
|
||||
SocketAddr::V4(ref a) => a.port(),
|
||||
@ -238,7 +238,7 @@ impl SocketAddr {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn is_ipv4(&self) -> bool {
|
||||
matches!(*self, SocketAddr::V4(_))
|
||||
}
|
||||
@ -260,7 +260,7 @@ impl SocketAddr {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "sockaddr_checker", since = "1.16.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn is_ipv6(&self) -> bool {
|
||||
matches!(*self, SocketAddr::V6(_))
|
||||
}
|
||||
@ -280,7 +280,7 @@ impl SocketAddrV4 {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
|
||||
SocketAddrV4 { ip, port }
|
||||
}
|
||||
@ -297,7 +297,7 @@ impl SocketAddrV4 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn ip(&self) -> &Ipv4Addr {
|
||||
&self.ip
|
||||
}
|
||||
@ -330,7 +330,7 @@ impl SocketAddrV4 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn port(&self) -> u16 {
|
||||
self.port
|
||||
}
|
||||
@ -371,7 +371,7 @@ impl SocketAddrV6 {
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[must_use]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
|
||||
SocketAddrV6 { ip, port, flowinfo, scope_id }
|
||||
}
|
||||
@ -388,7 +388,7 @@ impl SocketAddrV6 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn ip(&self) -> &Ipv6Addr {
|
||||
&self.ip
|
||||
}
|
||||
@ -421,7 +421,7 @@ impl SocketAddrV6 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn port(&self) -> u16 {
|
||||
self.port
|
||||
}
|
||||
@ -464,7 +464,7 @@ impl SocketAddrV6 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn flowinfo(&self) -> u32 {
|
||||
self.flowinfo
|
||||
}
|
||||
@ -504,7 +504,7 @@ impl SocketAddrV6 {
|
||||
/// ```
|
||||
#[must_use]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_const_unstable(feature = "const_socketaddr", issue = "82485")]
|
||||
#[rustc_const_stable(feature = "const_socketaddr", since = "CURRENT_RUSTC_VERSION")]
|
||||
pub const fn scope_id(&self) -> u32 {
|
||||
self.scope_id
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user