Skip to content

Commit

Permalink
Fix compilation errors on unsupported targets
Browse files Browse the repository at this point in the history
Also fix typos

Co-authored-by: Jubilee <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu and workingjubilee committed Jul 14, 2024
1 parent 4547b30 commit 6d2240d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
12 changes: 6 additions & 6 deletions library/std/src/sys/anonymous_pipe/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Module for annoymous pipe
//! Module for anonymous pipe
//!
//! ```
//! #![feature(anonymous_pipe)]
Expand All @@ -8,9 +8,9 @@
//! # }
//! ```
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)> {
Expand All @@ -25,12 +25,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);
Expand Down Expand Up @@ -137,5 +137,5 @@ mod unix;
#[cfg(windows)]
mod windows;

#[cfg(test)]
#[cfg(all(test, not(miri)))]
mod tests;
1 change: 1 addition & 0 deletions library/std/src/sys/anonymous_pipe/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/anonymous_pipe/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
11 changes: 10 additions & 1 deletion library/std/src/sys/pal/unsupported/pipe.rs
Original file line number Diff line number Diff line change
@@ -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> {
self.0
Expand Down

0 comments on commit 6d2240d

Please sign in to comment.