about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2021-08-19 16:15:29 -0700
committerDan Gohman <dev@sunfishcode.online>2021-08-19 16:15:29 -0700
commitb4dfa198bf4879bc159c7119bd4188ccd625f71d (patch)
tree1a49af6d6d3da17d8310b137632edcc3fe1fb232 /library/std/src
parente555003e6d6b6d71ce5509a6b6c7a15861208d6c (diff)
downloadrust-b4dfa198bf4879bc159c7119bd4188ccd625f71d.tar.gz
rust-b4dfa198bf4879bc159c7119bd4188ccd625f71d.zip
Fix doc test failures on Windows.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/fd/owned.rs1
-rw-r--r--library/std/src/os/fd/raw.rs4
-rw-r--r--library/std/src/os/windows/io/handle.rs3
3 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs
index ecaec8b21d8..52d7d4690d3 100644
--- a/library/std/src/os/fd/owned.rs
+++ b/library/std/src/os/fd/owned.rs
@@ -159,6 +159,7 @@ pub trait AsFd {
     /// # use std::os::unix::io::{AsFd, BorrowedFd};
     ///
     /// let mut f = File::open("foo.txt")?;
+    /// # #[cfg(any(unix, target_os = "wasi"))]
     /// let borrowed_fd: BorrowedFd<'_> = f.as_fd();
     /// # Ok::<(), io::Error>(())
     /// ```
diff --git a/library/std/src/os/fd/raw.rs b/library/std/src/os/fd/raw.rs
index dcbce9f10b8..f874cf0b42d 100644
--- a/library/std/src/os/fd/raw.rs
+++ b/library/std/src/os/fd/raw.rs
@@ -40,6 +40,7 @@ pub trait AsRawFd {
     ///
     /// let mut f = File::open("foo.txt")?;
     /// // Note that `raw_fd` is only valid as long as `f` exists.
+    /// #[cfg(any(unix, target_os = "wasi"))]
     /// let raw_fd: RawFd = f.as_raw_fd();
     /// # Ok::<(), io::Error>(())
     /// ```
@@ -75,9 +76,11 @@ pub trait FromRawFd {
     /// use std::os::wasi::io::{FromRawFd, IntoRawFd, RawFd};
     ///
     /// let f = File::open("foo.txt")?;
+    /// # #[cfg(any(unix, target_os = "wasi"))]
     /// let raw_fd: RawFd = f.into_raw_fd();
     /// // SAFETY: no other functions should call `from_raw_fd`, so there
     /// // is only one owner for the file descriptor.
+    /// # #[cfg(any(unix, target_os = "wasi"))]
     /// let f = unsafe { File::from_raw_fd(raw_fd) };
     /// # Ok::<(), io::Error>(())
     /// ```
@@ -106,6 +109,7 @@ pub trait IntoRawFd {
     /// use std::os::wasi::io::{IntoRawFd, RawFd};
     ///
     /// let f = File::open("foo.txt")?;
+    /// #[cfg(any(unix, target_os = "wasi"))]
     /// let raw_fd: RawFd = f.into_raw_fd();
     /// # Ok::<(), io::Error>(())
     /// ```
diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs
index 750a728d1ce..72a17adb3b4 100644
--- a/library/std/src/os/windows/io/handle.rs
+++ b/library/std/src/os/windows/io/handle.rs
@@ -237,9 +237,10 @@ pub trait AsHandle {
     /// # Example
     ///
     /// ```rust,no_run
+    /// # #![feature(io_safety)]
     /// use std::fs::File;
     /// # use std::io;
-    /// use std::os::windows::{AsHandle, BorrowedHandle};
+    /// use std::os::windows::io::{AsHandle, BorrowedHandle};
     ///
     /// let mut f = File::open("foo.txt")?;
     /// let borrowed_handle: BorrowedHandle<'_> = f.as_handle();