Skip to content

Commit 317bc8d

Browse files
Fix compilation errors on unsupported targets
Also fix typos Co-authored-by: Jubilee <[email protected]> Signed-off-by: Jiahao XU <[email protected]>
1 parent 4547b30 commit 317bc8d

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

library/std/src/sys/anonymous_pipe/mod.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
//! Module for annoymous pipe
1+
//! Module for anonymous pipe
22
//!
33
//! ```
4+
//! # #![cfg(not(miri))]
45
//! #![feature(anonymous_pipe)]
56
//! # fn main() -> std::io::Result<()> {
67
//! let (reader, writer) = std::pipe::pipe()?;
78
//! # Ok(())
89
//! # }
910
//! ```
1011
11-
use crate::{io, process::Stdio, sys::pipe::AnonPipe};
12+
use crate::{io, sys::pipe::AnonPipe};
1213

13-
/// Create annoymous pipe that is close-on-exec and blocking.
14+
/// Create anonymous pipe that is close-on-exec and blocking.
1415
#[unstable(feature = "anonymous_pipe", issue = "127154")]
1516
#[inline]
1617
pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> {
@@ -25,12 +26,12 @@ pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> {
2526
}
2627
}
2728

28-
/// Read end of the annoymous pipe.
29+
/// Read end of the anonymous pipe.
2930
#[unstable(feature = "anonymous_pipe", issue = "127154")]
3031
#[derive(Debug)]
3132
pub struct PipeReader(AnonPipe);
3233

33-
/// Write end of the annoymous pipe.
34+
/// Write end of the anonymous pipe.
3435
#[unstable(feature = "anonymous_pipe", issue = "127154")]
3536
#[derive(Debug)]
3637
pub struct PipeWriter(AnonPipe);
@@ -137,5 +138,5 @@ mod unix;
137138
#[cfg(windows)]
138139
mod windows;
139140

140-
#[cfg(test)]
141+
#[cfg(all(test, not(miri)))]
141142
mod tests;

library/std/src/sys/anonymous_pipe/unix.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use super::*;
22

33
use crate::{
44
os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd},
5+
process::Stdio,
56
sys::{
67
fd::FileDesc,
78
pipe::{anon_pipe, AnonPipe},

library/std/src/sys/anonymous_pipe/windows.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::{
44
os::windows::io::{
55
AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
66
},
7+
process::Stdio,
78
sys::{
89
handle::Handle,
910
pipe::{anon_pipe, AnonPipe, Pipes},

library/std/src/sys/pal/unsupported/pipe.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
1+
use crate::{
2+
fmt,
3+
io::{self, BorrowedCursor, IoSlice, IoSliceMut},
4+
};
25

36
pub struct AnonPipe(!);
47

8+
impl fmt::Debug for AnonPipe {
9+
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
10+
self.0
11+
}
12+
}
13+
514
impl AnonPipe {
615
pub fn try_clone(&self) -> io::Result<Self> {
716
self.0

0 commit comments

Comments
 (0)