diff --git a/library/std/src/sys/anonymous_pipe/mod.rs b/library/std/src/sys/anonymous_pipe/mod.rs index 118bcbaa75bf7..ec6d4bfffc23b 100644 --- a/library/std/src/sys/anonymous_pipe/mod.rs +++ b/library/std/src/sys/anonymous_pipe/mod.rs @@ -1,16 +1,19 @@ -//! Module for annoymous pipe +//! Module for anonymous pipe //! //! ``` //! #![feature(anonymous_pipe)] +//! +//! # #[cfg(miri)] fn main() {} +//! # #[cfg(not(miri))] //! # fn main() -> std::io::Result<()> { //! let (reader, writer) = std::pipe::pipe()?; //! # Ok(()) //! # } //! ``` -use crate::{io, process::Stdio, sys::pipe::AnonPipe}; +use crate::{io, sys::pipe::AnonPipe}; -/// Create annoymous pipe that is close-on-exec and blocking. +/// Create anonymous pipe that is close-on-exec and blocking. #[unstable(feature = "anonymous_pipe", issue = "127154")] #[inline] pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> { @@ -25,12 +28,12 @@ pub fn pipe() -> io::Result<(PipeReader, PipeWriter)> { } } -/// Read end of the annoymous pipe. +/// Read end of the anonymous pipe. #[unstable(feature = "anonymous_pipe", issue = "127154")] #[derive(Debug)] pub struct PipeReader(AnonPipe); -/// Write end of the annoymous pipe. +/// Write end of the anonymous pipe. #[unstable(feature = "anonymous_pipe", issue = "127154")] #[derive(Debug)] pub struct PipeWriter(AnonPipe); @@ -137,5 +140,5 @@ mod unix; #[cfg(windows)] mod windows; -#[cfg(test)] +#[cfg(all(test, not(miri)))] mod tests; diff --git a/library/std/src/sys/anonymous_pipe/unix.rs b/library/std/src/sys/anonymous_pipe/unix.rs index 18252f0183d3b..833f210dc65b6 100644 --- a/library/std/src/sys/anonymous_pipe/unix.rs +++ b/library/std/src/sys/anonymous_pipe/unix.rs @@ -2,6 +2,7 @@ use super::*; use crate::{ os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}, + process::Stdio, sys::{ fd::FileDesc, pipe::{anon_pipe, AnonPipe}, diff --git a/library/std/src/sys/anonymous_pipe/windows.rs b/library/std/src/sys/anonymous_pipe/windows.rs index 592e2f05a9ebf..d5398c3cc9ca8 100644 --- a/library/std/src/sys/anonymous_pipe/windows.rs +++ b/library/std/src/sys/anonymous_pipe/windows.rs @@ -4,6 +4,7 @@ use crate::{ os::windows::io::{ AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle, }, + process::Stdio, sys::{ handle::Handle, pipe::{anon_pipe, AnonPipe, Pipes}, diff --git a/library/std/src/sys/pal/unsupported/pipe.rs b/library/std/src/sys/pal/unsupported/pipe.rs index eaa95594db0b3..781eafe2f1a6b 100644 --- a/library/std/src/sys/pal/unsupported/pipe.rs +++ b/library/std/src/sys/pal/unsupported/pipe.rs @@ -1,7 +1,16 @@ -use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut}; +use crate::{ + fmt, + io::{self, BorrowedCursor, IoSlice, IoSliceMut}, +}; pub struct AnonPipe(!); +impl fmt::Debug for AnonPipe { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0 + } +} + impl AnonPipe { pub fn try_clone(&self) -> io::Result { self.0