Skip to content

Stabilize from_raw_os feature in 1.1 #25125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/libstd/sys/unix/ext/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub trait AsRawFd {

/// A trait to express the ability to construct an object from a raw file
/// descriptor.
#[unstable(feature = "from_raw_os",
reason = "recent addition to std::os::unix::io")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
pub trait FromRawFd {
/// Constructs a new instances of `Self` from the given raw file
/// descriptor.
Expand All @@ -56,6 +55,7 @@ pub trait FromRawFd {
/// descriptor they are wrapping. Usage of this function could
/// accidentally allow violating this contract which can cause memory
/// unsafety in code that relies on it being true.
#[stable(feature = "from_raw_os", since = "1.1.0")]
unsafe fn from_raw_fd(fd: RawFd) -> Self;
}

Expand All @@ -65,7 +65,7 @@ impl AsRawFd for fs::File {
self.as_inner().fd().raw()
}
}
#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for fs::File {
unsafe fn from_raw_fd(fd: RawFd) -> fs::File {
fs::File::from_inner(sys::fs2::File::from_inner(fd))
Expand All @@ -85,21 +85,21 @@ impl AsRawFd for net::UdpSocket {
fn as_raw_fd(&self) -> RawFd { *self.as_inner().socket().as_inner() }
}

#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::TcpStream {
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpStream {
let socket = sys::net::Socket::from_inner(fd);
net::TcpStream::from_inner(net2::TcpStream::from_inner(socket))
}
}
#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::TcpListener {
unsafe fn from_raw_fd(fd: RawFd) -> net::TcpListener {
let socket = sys::net::Socket::from_inner(fd);
net::TcpListener::from_inner(net2::TcpListener::from_inner(socket))
}
}
#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawFd for net::UdpSocket {
unsafe fn from_raw_fd(fd: RawFd) -> net::UdpSocket {
let socket = sys::net::Socket::from_inner(fd);
Expand Down
15 changes: 8 additions & 7 deletions src/libstd/sys/windows/ext/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pub trait AsRawHandle {
}

/// Construct I/O objects from raw handles.
#[unstable(feature = "from_raw_os",
reason = "recent addition to the std::os::windows::io module")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
pub trait FromRawHandle {
/// Constructs a new I/O object from the specified raw handle.
///
Expand All @@ -47,6 +46,7 @@ pub trait FromRawHandle {
/// descriptor they are wrapping. Usage of this function could
/// accidentally allow violating this contract which can cause memory
/// unsafety in code that relies on it being true.
#[stable(feature = "from_raw_os", since = "1.1.0")]
unsafe fn from_raw_handle(handle: RawHandle) -> Self;
}

Expand All @@ -57,7 +57,7 @@ impl AsRawHandle for fs::File {
}
}

#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawHandle for fs::File {
unsafe fn from_raw_handle(handle: RawHandle) -> fs::File {
let handle = handle as ::libc::HANDLE;
Expand All @@ -74,7 +74,7 @@ pub trait AsRawSocket {
}

/// Create I/O objects from raw sockets.
#[unstable(feature = "from_raw_os", reason = "recent addition to module")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
pub trait FromRawSocket {
/// Creates a new I/O object from the given raw socket.
///
Expand All @@ -86,6 +86,7 @@ pub trait FromRawSocket {
/// descriptor they are wrapping. Usage of this function could
/// accidentally allow violating this contract which can cause memory
/// unsafety in code that relies on it being true.
#[stable(feature = "from_raw_os", since = "1.1.0")]
unsafe fn from_raw_socket(sock: RawSocket) -> Self;
}

Expand All @@ -108,21 +109,21 @@ impl AsRawSocket for net::UdpSocket {
}
}

#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawSocket for net::TcpStream {
unsafe fn from_raw_socket(sock: RawSocket) -> net::TcpStream {
let sock = sys::net::Socket::from_inner(sock);
net::TcpStream::from_inner(net2::TcpStream::from_inner(sock))
}
}
#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawSocket for net::TcpListener {
unsafe fn from_raw_socket(sock: RawSocket) -> net::TcpListener {
let sock = sys::net::Socket::from_inner(sock);
net::TcpListener::from_inner(net2::TcpListener::from_inner(sock))
}
}
#[unstable(feature = "from_raw_os", reason = "trait is unstable")]
#[stable(feature = "from_raw_os", since = "1.1.0")]
impl FromRawSocket for net::UdpSocket {
unsafe fn from_raw_socket(sock: RawSocket) -> net::UdpSocket {
let sock = sys::net::Socket::from_inner(sock);
Expand Down