diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index 3a1b04a83fa7..37250e6a0ae4 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -205,6 +205,7 @@ pub trait AsFd { /// ```rust,no_run /// use std::fs::File; /// # use std::io; + /// # #[cfg(any(unix, target_os = "wasi"))] /// # use std::os::fd::{AsFd, BorrowedFd}; /// /// let mut f = File::open("foo.txt")?; diff --git a/library/std/src/os/fd/raw.rs b/library/std/src/os/fd/raw.rs index 42a9effcf92a..f92a05066706 100644 --- a/library/std/src/os/fd/raw.rs +++ b/library/std/src/os/fd/raw.rs @@ -42,6 +42,7 @@ pub trait AsRawFd { /// ```no_run /// use std::fs::File; /// # use std::io; + /// #[cfg(any(unix, target_os = "wasi"))] /// use std::os::fd::{AsRawFd, RawFd}; /// /// let mut f = File::open("foo.txt")?; @@ -80,6 +81,7 @@ pub trait FromRawFd { /// ```no_run /// use std::fs::File; /// # use std::io; + /// #[cfg(any(unix, target_os = "wasi"))] /// use std::os::fd::{FromRawFd, IntoRawFd, RawFd}; /// /// let f = File::open("foo.txt")?; @@ -115,6 +117,7 @@ pub trait IntoRawFd { /// ```no_run /// use std::fs::File; /// # use std::io; + /// #[cfg(any(unix, target_os = "wasi"))] /// use std::os::fd::{IntoRawFd, RawFd}; /// /// let f = File::open("foo.txt")?;