Skip to content

Commit 97626b6

Browse files
committed
Fix tidy errors
Signed-off-by: Jiahao XU <[email protected]>
1 parent 473fbce commit 97626b6

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

library/std/src/net/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pub use self::tcp::IntoIncoming;
3333
pub use self::tcp::{Incoming, TcpListener, TcpStream};
3434
#[stable(feature = "rust1", since = "1.0.0")]
3535
pub use self::udp::UdpSocket;
36+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
37+
pub use crate::sys::anonymous_pipe::{pipe, PipeReader, PipeWriter};
3638
#[stable(feature = "rust1", since = "1.0.0")]
3739
pub use core::net::AddrParseError;
3840

@@ -43,10 +45,6 @@ mod tcp;
4345
pub(crate) mod test;
4446
mod udp;
4547

46-
/// Anonymous pipe implementation
47-
#[unstable(feature = "anonymous_pipe", issue = "127154")]
48-
pub mod pipe;
49-
5048
/// Possible values which can be passed to the [`TcpStream::shutdown`] method.
5149
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
5250
#[stable(feature = "rust1", since = "1.0.0")]

library/std/src/net/pipe/mod.rs renamed to library/std/src/sys/anonymous_pipe.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::{io, process::Stdio, sys::pipe::AnonPipe};
22

33
/// Create annoymous pipe that is close-on-exec and blocking.
4+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
45
#[inline]
56
pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> {
67
cfg_if::cfg_if! {
@@ -13,29 +14,34 @@ pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> {
1314
}
1415

1516
/// Read end of the annoymous pipe.
17+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
1618
#[derive(Debug)]
1719
pub struct PipeReader(AnonPipe);
1820

1921
/// Write end of the annoymous pipe.
22+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
2023
#[derive(Debug)]
2124
pub struct PipeWriter(AnonPipe);
2225

2326
impl PipeReader {
2427
/// Create a new [`PipeReader`] instance that shares the same underlying file description.
28+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
2529
pub fn try_clone(&self) -> io::Result<Self> {
2630
self.0.try_clone().map(Self)
2731
}
2832
}
2933

3034
impl PipeWriter {
3135
/// Create a new [`PipeWriter`] instance that shares the same underlying file description.
36+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
3237
pub fn try_clone(&self) -> io::Result<Self> {
3338
self.0.try_clone().map(Self)
3439
}
3540
}
3641

3742
macro_rules! forward_io_read_traits {
3843
($name:ty) => {
44+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
3945
impl io::Read for $name {
4046
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
4147
self.0.read(buf)
@@ -60,6 +66,7 @@ forward_io_read_traits!(&PipeReader);
6066

6167
macro_rules! forward_io_write_traits {
6268
($name:ty) => {
69+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
6370
impl io::Write for $name {
6471
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
6572
self.0.write(buf)
@@ -104,31 +111,37 @@ mod unix {
104111

105112
macro_rules! impl_traits {
106113
($name:ty) => {
114+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
107115
impl AsFd for $name {
108116
fn as_fd(&self) -> BorrowedFd<'_> {
109117
self.0.as_fd()
110118
}
111119
}
120+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
112121
impl AsRawFd for $name {
113122
fn as_raw_fd(&self) -> RawFd {
114123
self.0.as_raw_fd()
115124
}
116125
}
126+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
117127
impl From<$name> for OwnedFd {
118128
fn from(pipe: $name) -> Self {
119129
FileDesc::into_inner(AnonPipe::into_inner(pipe.0))
120130
}
121131
}
132+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
122133
impl FromRawFd for $name {
123134
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
124135
Self(AnonPipe::from_raw_fd(raw_fd))
125136
}
126137
}
138+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
127139
impl IntoRawFd for $name {
128140
fn into_raw_fd(self) -> RawFd {
129141
self.0.into_raw_fd()
130142
}
131143
}
144+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
132145
impl From<$name> for Stdio {
133146
fn from(pipe: $name) -> Self {
134147
Self::from(OwnedFd::from(pipe))
@@ -177,6 +190,7 @@ mod unix {
177190
}
178191
}
179192

193+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
180194
impl TryFrom<OwnedFd> for PipeReader {
181195
type Error = io::Error;
182196

@@ -187,6 +201,7 @@ mod unix {
187201
}
188202
}
189203

204+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
190205
impl TryFrom<OwnedFd> for PipeWriter {
191206
type Error = io::Error;
192207

@@ -221,33 +236,39 @@ mod windows {
221236

222237
macro_rules! impl_traits {
223238
($name:ty) => {
239+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
224240
impl AsHandle for $name {
225241
fn as_handle(&self) -> BorrowedHandle<'_> {
226242
self.0.handle().as_handle()
227243
}
228244
}
245+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
229246
impl AsRawHandle for $name {
230247
fn as_raw_handle(&self) -> RawHandle {
231248
self.0.handle().as_raw_handle()
232249
}
233250
}
234251

252+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
235253
impl FromRawHandle for $name {
236254
unsafe fn from_raw_handle(raw_handle: RawHandle) -> Self {
237255
Self(AnonPipe::from_inner(Handle::from_raw_handle(raw_handle)))
238256
}
239257
}
258+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
240259
impl IntoRawHandle for $name {
241260
fn into_raw_handle(self) -> RawHandle {
242261
self.0.into_handle().into_raw_handle()
243262
}
244263
}
245264

265+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
246266
impl From<$name> for OwnedHandle {
247267
fn from(pipe: $name) -> Self {
248268
Handle::into_inner(AnonPipe::into_inner(pipe.0))
249269
}
250270
}
271+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
251272
impl From<$name> for Stdio {
252273
fn from(pipe: $name) -> Self {
253274
Self::from(OwnedHandle::from(pipe))
@@ -262,6 +283,7 @@ mod windows {
262283
AnonPipe::from_inner(Handle::from_inner(owned_handle))
263284
}
264285

286+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
265287
impl TryFrom<OwnedHandle> for PipeReader {
266288
type Error = io::Error;
267289

@@ -270,6 +292,7 @@ mod windows {
270292
}
271293
}
272294

295+
#[unstable(feature = "anonymous_pipe", issue = "127154")]
273296
impl TryFrom<OwnedHandle> for PipeWriter {
274297
type Error = io::Error;
275298

library/std/src/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod pal;
55

66
mod personality;
77

8+
pub mod anonymous_pipe;
89
pub mod backtrace;
910
pub mod cmath;
1011
pub mod os_str;

0 commit comments

Comments
 (0)