Skip to content

Commit

Permalink
Stabilise unix_socket_abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillikin committed Mar 18, 2023
1 parent 586e615 commit 12b5f6d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions std/src/os/android/net.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Android-specific networking functionality.

#![unstable(feature = "tcp_quickack", issue = "96256")]
#![stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]

#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub use crate::os::net::linux_ext::addr::SocketAddrExt;

#[unstable(feature = "tcp_quickack", issue = "96256")]
Expand Down
4 changes: 2 additions & 2 deletions std/src/os/linux/net.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Linux-specific networking functionality.

#![unstable(feature = "tcp_quickack", issue = "96256")]
#![stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]

#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub use crate::os::net::linux_ext::addr::SocketAddrExt;

#[unstable(feature = "tcp_quickack", issue = "96256")]
Expand Down
6 changes: 3 additions & 3 deletions std/src/os/net/linux_ext/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::os::unix::net::SocketAddr;
use crate::sealed::Sealed;

/// Platform-specific extensions to [`SocketAddr`].
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub trait SocketAddrExt: Sealed {
/// Creates a Unix socket address in the abstract namespace.
///
Expand All @@ -22,7 +22,6 @@ pub trait SocketAddrExt: Sealed {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixListener, SocketAddr};
/// use std::os::linux::net::SocketAddrExt;
///
Expand All @@ -38,6 +37,7 @@ pub trait SocketAddrExt: Sealed {
/// Ok(())
/// }
/// ```
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
fn from_abstract_name<N>(name: N) -> crate::io::Result<SocketAddr>
where
N: AsRef<[u8]>;
Expand All @@ -47,7 +47,6 @@ pub trait SocketAddrExt: Sealed {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixListener, SocketAddr};
/// use std::os::linux::net::SocketAddrExt;
///
Expand All @@ -60,5 +59,6 @@ pub trait SocketAddrExt: Sealed {
/// Ok(())
/// }
/// ```
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
fn as_abstract_name(&self) -> Option<&[u8]>;
}
2 changes: 1 addition & 1 deletion std/src/os/net/linux_ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#![doc(cfg(any(target_os = "linux", target_os = "android")))]

#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub(crate) mod addr;

#[unstable(feature = "tcp_quickack", issue = "96256")]
Expand Down
4 changes: 2 additions & 2 deletions std/src/os/unix/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ impl SocketAddr {
}
}

#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
impl Sealed for SocketAddr {}

#[doc(cfg(any(target_os = "android", target_os = "linux")))]
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
impl linux_ext::addr::SocketAddrExt for SocketAddr {
fn as_abstract_name(&self) -> Option<&[u8]> {
if let AddressKind::Abstract(name) = self.address() { Some(name) } else { None }
Expand Down
9 changes: 3 additions & 6 deletions std/src/os/unix/net/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ impl UnixDatagram {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixDatagram};
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -119,7 +118,7 @@ impl UnixDatagram {
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub fn bind_addr(socket_addr: &SocketAddr) -> io::Result<UnixDatagram> {
unsafe {
let socket = UnixDatagram::unbound()?;
Expand Down Expand Up @@ -217,7 +216,6 @@ impl UnixDatagram {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixDatagram};
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -235,7 +233,7 @@ impl UnixDatagram {
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub fn connect_addr(&self, socket_addr: &SocketAddr) -> io::Result<()> {
unsafe {
cvt(libc::connect(
Expand Down Expand Up @@ -523,7 +521,6 @@ impl UnixDatagram {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixDatagram};
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -535,7 +532,7 @@ impl UnixDatagram {
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub fn send_to_addr(&self, buf: &[u8], socket_addr: &SocketAddr) -> io::Result<usize> {
unsafe {
let count = cvt(libc::sendto(
Expand Down
3 changes: 1 addition & 2 deletions std/src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ impl UnixListener {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixListener};
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -107,7 +106,7 @@ impl UnixListener {
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub fn bind_addr(socket_addr: &SocketAddr) -> io::Result<UnixListener> {
unsafe {
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
Expand Down
3 changes: 1 addition & 2 deletions std/src/os/unix/net/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ impl UnixStream {
/// # Examples
///
/// ```no_run
/// #![feature(unix_socket_abstract)]
/// use std::os::unix::net::{UnixListener, UnixStream};
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -123,7 +122,7 @@ impl UnixStream {
/// Ok(())
/// }
/// ````
#[unstable(feature = "unix_socket_abstract", issue = "85410")]
#[stable(feature = "unix_socket_abstract", since = "CURRENT_RUSTC_VERSION")]
pub fn connect_addr(socket_addr: &SocketAddr) -> io::Result<UnixStream> {
unsafe {
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
Expand Down

0 comments on commit 12b5f6d

Please sign in to comment.