Skip to content

Commit 913911f

Browse files
committed
feature gate windows_unix_domain_sockets
1 parent 7fb993a commit 913911f

File tree

4 files changed

+8
-46
lines changed

4 files changed

+8
-46
lines changed

library/std/src/os/windows/net/addr.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#![stable(feature = "rust1", since = "1.0.0")]
1+
#![unstable(feature = "windows_unix_domain_sockets", issue = "none")]
22

33
use crate::os::raw::{c_char, c_int};
44
use crate::path::Path;
55
use crate::sys::c::{self, SOCKADDR};
66
use crate::sys::cvt;
77
use crate::{io, mem};
8-
#[stable(feature = "rust1", since = "1.0.0")]
98
pub fn sockaddr_un(path: &Path) -> io::Result<(c::sockaddr_un, c_int)> {
109
let mut addr: c::sockaddr_un = unsafe { mem::zeroed() };
1110
addr.sun_family = c::AF_UNIX;
@@ -47,13 +46,11 @@ fn sun_path_offset(addr: &c::sockaddr_un) -> usize {
4746
let path = &addr.sun_path as *const _ as usize;
4847
path - base
4948
}
50-
#[stable(feature = "rust1", since = "1.0.0")]
5149
pub struct SocketAddr {
5250
addr: c::sockaddr_un,
5351
len: c_int,
5452
}
5553
impl SocketAddr {
56-
#[stable(feature = "rust1", since = "1.0.0")]
5754
pub fn new<F>(f: F) -> io::Result<SocketAddr>
5855
where
5956
F: FnOnce(*mut SOCKADDR, *mut c_int) -> c_int,
@@ -80,7 +77,6 @@ impl SocketAddr {
8077
Ok(SocketAddr { addr, len })
8178
}
8279
}
83-
#[stable(feature = "rust1", since = "1.0.0")]
8480
pub fn from_sockaddr_un(addr: c::sockaddr_un, len: c_int) -> io::Result<SocketAddr> {
8581
SocketAddr::from_parts(addr, len)
8682
}

library/std/src/os/windows/net/listener.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![unstable(feature = "windows_unix_domain_sockets", issue = "none")]
2+
13
use core::mem;
24

35
use super::sockaddr_un;
@@ -9,13 +11,10 @@ use crate::path::Path;
911
use crate::sys::c::{self, bind, getsockname, listen};
1012
use crate::sys::cvt;
1113
use crate::sys::net::Socket;
12-
#[stable(feature = "rust1", since = "1.0.0")]
1314

1415
pub struct UnixListener(Socket);
15-
#[stable(feature = "rust1", since = "1.0.0")]
1616

1717
impl UnixListener {
18-
#[stable(feature = "rust1", since = "1.0.0")]
1918
pub fn bind<P: AsRef<Path>>(path: &Path) -> io::Result<UnixListener> {
2019
unsafe {
2120
let inner = Socket::new_unix()?;
@@ -25,40 +24,34 @@ impl UnixListener {
2524
Ok(UnixListener(inner))
2625
}
2726
}
28-
#[stable(feature = "rust1", since = "1.0.0")]
2927
pub fn accept(&self) -> io::Result<(UnixStream, SocketAddr)> {
3028
let mut storage: c::sockaddr_un = unsafe { mem::zeroed() };
3129
let mut len = mem::size_of_val(&storage) as c_int;
3230
let sock = self.0.accept(&mut storage as *mut _ as *mut _, &mut len)?;
3331
let addr = from_sockaddr_un(storage, len)?;
3432
Ok((UnixStream(sock), addr))
3533
}
36-
#[stable(feature = "rust1", since = "1.0.0")]
3734
pub fn incoming(&self) -> Incoming<'_> {
3835
Incoming { listener: self }
3936
}
40-
#[stable(feature = "rust1", since = "1.0.0")]
4137
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
4238
self.0.take_error()
4339
}
44-
#[stable(feature = "rust1", since = "1.0.0")]
4540
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
4641
self.0.set_nonblocking(nonblocking)
4742
}
48-
#[stable(feature = "rust1", since = "1.0.0")]
4943
pub fn local_addr(&self) -> io::Result<SocketAddr> {
5044
SocketAddr::new(|addr, len| unsafe { getsockname(self.0.as_raw() as _, addr, len) })
5145
}
52-
#[stable(feature = "rust1", since = "1.0.0")]
5346
pub fn try_clone(&self) -> io::Result<UnixListener> {
5447
self.0.duplicate().map(UnixListener)
5548
}
5649
}
57-
#[stable(feature = "rust1", since = "1.0.0")]
50+
5851
pub struct Incoming<'a> {
5952
listener: &'a UnixListener,
6053
}
61-
#[stable(feature = "rust1", since = "1.0.0")]
54+
6255
impl<'a> Iterator for Incoming<'a> {
6356
type Item = io::Result<UnixStream>;
6457

@@ -70,21 +63,19 @@ impl<'a> Iterator for Incoming<'a> {
7063
(usize::max_value(), None)
7164
}
7265
}
73-
#[stable(feature = "rust1", since = "1.0.0")]
66+
7467
impl AsRawSocket for UnixListener {
7568
fn as_raw_socket(&self) -> RawSocket {
7669
self.0.as_raw_socket()
7770
}
7871
}
7972

80-
#[stable(feature = "rust1", since = "1.0.0")]
8173
impl FromRawSocket for UnixListener {
8274
unsafe fn from_raw_socket(sock: RawSocket) -> Self {
8375
UnixListener(unsafe { Socket::from_raw_socket(sock) })
8476
}
8577
}
8678

87-
#[stable(feature = "rust1", since = "1.0.0")]
8879
impl IntoRawSocket for UnixListener {
8980
fn into_raw_socket(self) -> RawSocket {
9081
let ret = self.0.as_raw_socket();
@@ -93,7 +84,6 @@ impl IntoRawSocket for UnixListener {
9384
}
9485
}
9586

96-
#[stable(feature = "rust1", since = "1.0.0")]
9787
impl<'a> IntoIterator for &'a UnixListener {
9888
type Item = io::Result<UnixStream>;
9989
type IntoIter = Incoming<'a>;
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
#![stable(feature = "rust1", since = "1.0.0")]
1+
#![unstable(feature = "windows_unix_domain_sockets", issue = "none")]
22

33
mod addr;
44
mod listener;
55
mod stream;
6-
#[stable(feature = "rust1", since = "1.0.0")]
76
pub use addr::*;
8-
#[stable(feature = "rust1", since = "1.0.0")]
97
pub use listener::*;
10-
#[stable(feature = "rust1", since = "1.0.0")]
118
pub use stream::*;

library/std/src/os/windows/net/stream.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![stable(feature = "rust1", since = "1.0.0")]
1+
#![unstable(feature = "windows_unix_domain_sockets", issue = "none")]
22

33
use core::mem;
44
use core::time::Duration;
@@ -14,10 +14,8 @@ use crate::sys::c::{SO_RCVTIMEO, SO_SNDTIMEO, connect, getpeername, getsockname}
1414
use crate::sys::cvt;
1515
use crate::sys::net::Socket;
1616

17-
#[stable(feature = "rust1", since = "1.0.0")]
1817
pub struct UnixStream(pub Socket);
1918
impl UnixStream {
20-
#[stable(feature = "rust1", since = "1.0.0")]
2119
pub fn connect<P: AsRef<Path>>(path: P) -> io::Result<UnixStream> {
2220
unsafe {
2321
let inner = Socket::new_unix()?;
@@ -26,64 +24,50 @@ impl UnixStream {
2624
Ok(UnixStream(inner))
2725
}
2826
}
29-
#[stable(feature = "rust1", since = "1.0.0")]
30-
3127
pub fn local_addr(&self) -> io::Result<SocketAddr> {
3228
SocketAddr::new(|addr, len| unsafe { getsockname(self.0.as_raw() as _, addr, len) })
3329
}
34-
#[stable(feature = "rust1", since = "1.0.0")]
3530
pub fn peer_addr(&self) -> io::Result<SocketAddr> {
3631
SocketAddr::new(|addr, len| unsafe { getpeername(self.0.as_raw() as _, addr, len) })
3732
}
38-
#[stable(feature = "rust1", since = "1.0.0")]
3933
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
4034
self.0.timeout(SO_RCVTIMEO)
4135
}
42-
#[stable(feature = "rust1", since = "1.0.0")]
4336
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
4437
self.0.set_nonblocking(nonblocking)
4538
}
46-
#[stable(feature = "rust1", since = "1.0.0")]
4739
pub fn set_read_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
4840
self.0.set_timeout(dur, SO_RCVTIMEO)
4941
}
50-
#[stable(feature = "rust1", since = "1.0.0")]
5142
pub fn set_write_timeout(&self, dur: Option<Duration>) -> io::Result<()> {
5243
self.0.set_timeout(dur, SO_SNDTIMEO)
5344
}
54-
#[stable(feature = "rust1", since = "1.0.0")]
5545
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
5646
self.0.shutdown(how)
5747
}
58-
#[stable(feature = "rust1", since = "1.0.0")]
5948
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
6049
self.0.take_error()
6150
}
62-
#[stable(feature = "rust1", since = "1.0.0")]
6351
pub fn try_clone(&self) -> io::Result<UnixStream> {
6452
self.0.duplicate().map(UnixStream)
6553
}
66-
#[stable(feature = "rust1", since = "1.0.0")]
6754
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
6855
self.0.timeout(SO_SNDTIMEO)
6956
}
7057
}
7158

72-
#[stable(feature = "rust1", since = "1.0.0")]
7359
impl io::Read for UnixStream {
7460
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
7561
io::Read::read(&mut &*self, buf)
7662
}
7763
}
7864

79-
#[stable(feature = "rust1", since = "1.0.0")]
8065
impl<'a> io::Read for &'a UnixStream {
8166
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
8267
self.0.read(buf)
8368
}
8469
}
8570

86-
#[stable(feature = "rust1", since = "1.0.0")]
8771
impl io::Write for UnixStream {
8872
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
8973
io::Write::write(&mut &*self, buf)
@@ -93,7 +77,6 @@ impl io::Write for UnixStream {
9377
io::Write::flush(&mut &*self)
9478
}
9579
}
96-
#[stable(feature = "rust1", since = "1.0.0")]
9780
impl<'a> io::Write for &'a UnixStream {
9881
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
9982
self.0.write_vectored(&[IoSlice::new(buf)])
@@ -104,28 +87,24 @@ impl<'a> io::Write for &'a UnixStream {
10487
}
10588
}
10689

107-
#[stable(feature = "rust1", since = "1.0.0")]
10890
impl AsSocket for UnixStream {
10991
fn as_socket(&self) -> BorrowedSocket {
11092
self.0.as_socket()
11193
}
11294
}
11395

114-
#[stable(feature = "rust1", since = "1.0.0")]
11596
impl AsRawSocket for UnixStream {
11697
fn as_raw_socket(&self) -> RawSocket {
11798
self.0.as_raw_socket()
11899
}
119100
}
120101

121-
#[stable(feature = "rust1", since = "1.0.0")]
122102
impl FromRawSocket for UnixStream {
123103
unsafe fn from_raw_socket(sock: RawSocket) -> Self {
124104
unsafe { UnixStream(Socket::from_raw_socket(sock)) }
125105
}
126106
}
127107

128-
#[stable(feature = "rust1", since = "1.0.0")]
129108
impl IntoRawSocket for UnixStream {
130109
fn into_raw_socket(self) -> RawSocket {
131110
let ret = self.0.as_raw_socket();

0 commit comments

Comments
 (0)