Skip to content

Commit

Permalink
Rollup merge of rust-lang#60373 - rasendubi:lang-features-sort-since,…
Browse files Browse the repository at this point in the history
… r=Centril

Tidy: ensure lang features are sorted by since

This is the tidy side of rust-lang#60361.

What is left is actually splitting features into groups and sorting by since.

This PR also likely to produce a small (a couple of lines) merge conflict with rust-lang#60362.

r? @Centril
  • Loading branch information
Centril committed May 2, 2019
2 parents 3010b14 + 201f14b commit d38096a
Show file tree
Hide file tree
Showing 7 changed files with 256 additions and 82 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3553,6 +3553,7 @@ dependencies = [
name = "tidy"
version = "0.1.0"
dependencies = [
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
Expand Down
82 changes: 41 additions & 41 deletions src/libstd/sys/redox/ext/net.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![stable(feature = "unix_socket_redox", since = "1.29")]
#![stable(feature = "unix_socket_redox", since = "1.29.0")]

//! Unix-specific networking functionality

Expand Down Expand Up @@ -27,7 +27,7 @@ use crate::sys::{cvt, fd::FileDesc, syscall};
/// let addr = socket.local_addr().expect("Couldn't get local address");
/// ```
#[derive(Clone)]
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub struct SocketAddr(());

impl SocketAddr {
Expand Down Expand Up @@ -55,7 +55,7 @@ impl SocketAddr {
/// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.as_pathname(), None);
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn as_pathname(&self) -> Option<&Path> {
None
}
Expand Down Expand Up @@ -83,12 +83,12 @@ impl SocketAddr {
/// let addr = socket.local_addr().expect("Couldn't get local address");
/// assert_eq!(addr.is_unnamed(), true);
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn is_unnamed(&self) -> bool {
false
}
}
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl fmt::Debug for SocketAddr {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "SocketAddr")
Expand All @@ -109,10 +109,10 @@ impl fmt::Debug for SocketAddr {
/// stream.read_to_string(&mut response).unwrap();
/// println!("{}", response);
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub struct UnixStream(FileDesc);

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl fmt::Debug for UnixStream {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixStream");
Expand Down Expand Up @@ -143,7 +143,7 @@ impl UnixStream {
/// }
/// };
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn connect<P: AsRef<Path>>(path: P) -> io::Result<UnixStream> {
if let Some(s) = path.as_ref().to_str() {
cvt(syscall::open(format!("chan:{}", s), syscall::O_CLOEXEC))
Expand Down Expand Up @@ -174,7 +174,7 @@ impl UnixStream {
/// }
/// };
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn pair() -> io::Result<(UnixStream, UnixStream)> {
let server = cvt(syscall::open("chan:", syscall::O_CREAT | syscall::O_CLOEXEC))
.map(FileDesc::new)?;
Expand All @@ -198,7 +198,7 @@ impl UnixStream {
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
/// let sock_copy = socket.try_clone().expect("Couldn't clone socket");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn try_clone(&self) -> io::Result<UnixStream> {
self.0.duplicate().map(UnixStream)
}
Expand All @@ -213,7 +213,7 @@ impl UnixStream {
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
/// let addr = socket.local_addr().expect("Couldn't get local address");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn local_addr(&self) -> io::Result<SocketAddr> {
Err(Error::new(ErrorKind::Other, "UnixStream::local_addr unimplemented on redox"))
}
Expand All @@ -228,7 +228,7 @@ impl UnixStream {
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
/// let addr = socket.peer_addr().expect("Couldn't get peer address");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn peer_addr(&self) -> io::Result<SocketAddr> {
Err(Error::new(ErrorKind::Other, "UnixStream::peer_addr unimplemented on redox"))
}
Expand Down Expand Up @@ -267,7 +267,7 @@ impl UnixStream {
/// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn set_read_timeout(&self, _timeout: Option<Duration>) -> io::Result<()> {
Err(Error::new(ErrorKind::Other, "UnixStream::set_read_timeout unimplemented on redox"))
}
Expand Down Expand Up @@ -306,7 +306,7 @@ impl UnixStream {
/// let err = result.unwrap_err();
/// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn set_write_timeout(&self, _timeout: Option<Duration>) -> io::Result<()> {
Err(Error::new(ErrorKind::Other, "UnixStream::set_write_timeout unimplemented on redox"))
}
Expand All @@ -323,7 +323,7 @@ impl UnixStream {
/// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
/// assert_eq!(socket.read_timeout().unwrap(), Some(Duration::new(1, 0)));
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
Err(Error::new(ErrorKind::Other, "UnixStream::read_timeout unimplemented on redox"))
}
Expand All @@ -340,7 +340,7 @@ impl UnixStream {
/// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout");
/// assert_eq!(socket.write_timeout().unwrap(), Some(Duration::new(1, 0)));
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
Err(Error::new(ErrorKind::Other, "UnixStream::write_timeout unimplemented on redox"))
}
Expand All @@ -355,7 +355,7 @@ impl UnixStream {
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
/// socket.set_nonblocking(true).expect("Couldn't set nonblocking");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.0.set_nonblocking(nonblocking)
}
Expand All @@ -375,7 +375,7 @@ impl UnixStream {
///
/// # Platform specific
/// On Redox this always returns `None`.
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
Ok(None)
}
Expand All @@ -397,13 +397,13 @@ impl UnixStream {
/// let socket = UnixStream::connect("/tmp/sock").unwrap();
/// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn shutdown(&self, _how: Shutdown) -> io::Result<()> {
Err(Error::new(ErrorKind::Other, "UnixStream::shutdown unimplemented on redox"))
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl io::Read for UnixStream {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
io::Read::read(&mut &*self, buf)
Expand All @@ -415,7 +415,7 @@ impl io::Read for UnixStream {
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl<'a> io::Read for &'a UnixStream {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
Expand All @@ -427,7 +427,7 @@ impl<'a> io::Read for &'a UnixStream {
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl io::Write for UnixStream {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
io::Write::write(&mut &*self, buf)
Expand All @@ -438,7 +438,7 @@ impl io::Write for UnixStream {
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl<'a> io::Write for &'a UnixStream {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
Expand All @@ -449,21 +449,21 @@ impl<'a> io::Write for &'a UnixStream {
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl AsRawFd for UnixStream {
fn as_raw_fd(&self) -> RawFd {
self.0.raw()
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl FromRawFd for UnixStream {
unsafe fn from_raw_fd(fd: RawFd) -> UnixStream {
UnixStream(FileDesc::new(fd))
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl IntoRawFd for UnixStream {
fn into_raw_fd(self) -> RawFd {
self.0.into_raw()
Expand Down Expand Up @@ -498,10 +498,10 @@ impl IntoRawFd for UnixStream {
/// }
/// }
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub struct UnixListener(FileDesc);

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl fmt::Debug for UnixListener {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixListener");
Expand Down Expand Up @@ -529,7 +529,7 @@ impl UnixListener {
/// }
/// };
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn bind<P: AsRef<Path>>(path: P) -> io::Result<UnixListener> {
if let Some(s) = path.as_ref().to_str() {
cvt(syscall::open(format!("chan:{}", s), syscall::O_CREAT | syscall::O_CLOEXEC))
Expand Down Expand Up @@ -563,7 +563,7 @@ impl UnixListener {
/// Err(e) => println!("accept function failed: {:?}", e),
/// }
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn accept(&self) -> io::Result<(UnixStream, SocketAddr)> {
self.0.duplicate_path(b"listen").map(|fd| (UnixStream(fd), SocketAddr(())))
}
Expand All @@ -583,7 +583,7 @@ impl UnixListener {
///
/// let listener_copy = listener.try_clone().expect("try_clone failed");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn try_clone(&self) -> io::Result<UnixListener> {
self.0.duplicate().map(UnixListener)
}
Expand All @@ -599,7 +599,7 @@ impl UnixListener {
///
/// let addr = listener.local_addr().expect("Couldn't get local address");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn local_addr(&self) -> io::Result<SocketAddr> {
Err(Error::new(ErrorKind::Other, "UnixListener::local_addr unimplemented on redox"))
}
Expand All @@ -615,7 +615,7 @@ impl UnixListener {
///
/// listener.set_nonblocking(true).expect("Couldn't set non blocking");
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
self.0.set_nonblocking(nonblocking)
}
Expand All @@ -636,7 +636,7 @@ impl UnixListener {
///
/// # Platform specific
/// On Redox this always returns `None`.
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
Ok(None)
}
Expand Down Expand Up @@ -672,34 +672,34 @@ impl UnixListener {
/// }
/// }
/// ```
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub fn incoming<'a>(&'a self) -> Incoming<'a> {
Incoming { listener: self }
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl AsRawFd for UnixListener {
fn as_raw_fd(&self) -> RawFd {
self.0.raw()
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl FromRawFd for UnixListener {
unsafe fn from_raw_fd(fd: RawFd) -> UnixListener {
UnixListener(FileDesc::new(fd))
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl IntoRawFd for UnixListener {
fn into_raw_fd(self) -> RawFd {
self.0.into_raw()
}
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl<'a> IntoIterator for &'a UnixListener {
type Item = io::Result<UnixStream>;
type IntoIter = Incoming<'a>;
Expand Down Expand Up @@ -740,12 +740,12 @@ impl<'a> IntoIterator for &'a UnixListener {
/// }
/// ```
#[derive(Debug)]
#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
pub struct Incoming<'a> {
listener: &'a UnixListener,
}

#[stable(feature = "unix_socket_redox", since = "1.29")]
#[stable(feature = "unix_socket_redox", since = "1.29.0")]
impl<'a> Iterator for Incoming<'a> {
type Item = io::Result<UnixStream>;

Expand Down
Loading

0 comments on commit d38096a

Please sign in to comment.