about summary refs log tree commit diff
path: root/library/std/src/os
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2021-02-22 14:21:43 -0800
committerDan Gohman <dev@sunfishcode.online>2021-02-23 05:40:08 -0800
commit132ec261b0d215f77b71eeee3d814cd304fc1a29 (patch)
tree65a17c82edeeb35b3d25c17906b4d6313de96a22 /library/std/src/os
parent446d4533e89db04f9568be4199e56b5fce0d176d (diff)
downloadrust-132ec261b0d215f77b71eeee3d814cd304fc1a29.tar.gz
rust-132ec261b0d215f77b71eeee3d814cd304fc1a29.zip
Enable API documentation for `std::os::wasi`.
This adds API documentation support for `std::os::wasi` modeled after
how `std::os::unix` works, so that WASI can be documented [here] along
with the other platforms.

[here]: https://doc.rust-lang.org/stable/std/os/index.html

Two changes of particular interest:

 - This changes the `AsRawFd` for `io::Stdin` for WASI to return
   `libc::STDIN_FILENO` instead of `sys::stdio::Stdin.as_raw_fd()` (and
   similar for `Stdout` and `Stderr`), which matches how the `unix`
   version works. `STDIN_FILENO` etc. may not always be explicitly
   reserved at the WASI level, but as long as we have Rust's `std` and
   `libc`, I think it's reasonable to guarantee that we'll always use
   `libc::STDIN_FILENO` for stdin.

 - This duplicates the `osstr2str` utility function, rather than
   trying to share it across all the configurations that need it.
Diffstat (limited to 'library/std/src/os')
-rw-r--r--library/std/src/os/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs
index f61e402e370..fad5886def7 100644
--- a/library/std/src/os/mod.rs
+++ b/library/std/src/os/mod.rs
@@ -22,6 +22,9 @@ pub use crate::sys::windows_ext as windows;
 #[doc(cfg(target_os = "linux"))]
 pub mod linux;
 
+#[cfg(doc)]
+pub use crate::sys::wasi_ext as wasi;
+
 // If we're not documenting libstd then we just expose the main modules as we otherwise would.
 
 #[cfg(not(doc))]