Enable API documentation for std::os::wasi.#82420
Conversation
|
@bors: r+ |
|
📌 Commit 643d2ce3e2de481593bc4aaee81f1df361680864 has been approved by |
|
☔ The latest upstream changes (presumably #82430) made this pull request unmergeable. Please resolve the merge conflicts. |
643d2ce to
5c46468
Compare
This comment has been minimized.
This comment has been minimized.
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.
5c46468 to
132ec26
Compare
|
@bors: r+ delegate+ |
|
📌 Commit 132ec26 has been approved by |
|
✌️ @sunfishcode can now approve this pull request |
|
Currently the documentation does not build for all platforms: rust/library/std/src/sys/wasi/ext/mod.rs Lines 11 to 24 in fe1bf8e All these should use Also, technically if one would ever document targeting wasi (not currently possible I think) the module rust/library/std/src/os/mod.rs Lines 71 to 72 in fe1bf8e and now wasi can also be added to the comment at the top of rust/library/std/src/os/mod.rs Line 6 in fe1bf8e |
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. r? `@alexcrichton`
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. r? ``@alexcrichton``
|
Failed in rollup: #82472 (comment) |
WASI's `RawFd` is a `u32`, while `libc` uses `c_int`.
This ensures that these names resolve to the right place even when building the WASI support on other platforms for generating the documentation.
|
Thanks! I've now fixed the |
|
@bors: r+ |
|
📌 Commit 7d5242a has been approved by |
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. r? `@alexcrichton`
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. r? ``@alexcrichton``
Rollup of 14 pull requests Successful merges: - rust-lang#81794 (update tracking issue for `relaxed_struct_unsize`) - rust-lang#82057 (Replace const_cstr with cstr crate) - rust-lang#82370 (Improve anonymous lifetime note to indicate the target span) - rust-lang#82394 (:arrow_up: rust-analyzer) - rust-lang#82396 (Add Future trait for doc_spotlight feature doc) - rust-lang#82404 (Test hexagon-enum only when llvm target is present) - rust-lang#82419 (expand: Preserve order of inert attributes during expansion) - rust-lang#82420 (Enable API documentation for `std::os::wasi`.) - rust-lang#82421 (Add a `size()` function to WASI's `MetadataExt`.) - rust-lang#82442 (Skip emitting closure diagnostic when closure_kind_origins has no entry) - rust-lang#82473 (Use libc::accept4 on Android instead of raw syscall.) - rust-lang#82482 (Use small hash set in `mir_inliner_callees`) - rust-lang#82490 (Update cargo) - rust-lang#82494 (Substitute erased lifetimes on bad placeholder type) Failed merges: - rust-lang#82448 (Combine HasAttrs and HasTokens into AstLike) r? `@ghost` `@rustbot` modify labels: rollup
As a followup to [this comment] in rust-lang#82420, this patch teaches rustdoc how to display WASI. [this comment]: rust-lang#82420 (comment)
Teach rustdoc how to display WASI. As a followup to [this comment] in rust-lang#82420, this patch teaches rustdoc how to display WASI. [this comment]: rust-lang#82420 (comment) r? `@alexcrichton`
This adds API documentation support for
std::os::wasimodeled afterhow
std::os::unixworks, so that WASI can be documented here alongwith the other platforms.
Two changes of particular interest:
This changes the
AsRawFdforio::Stdinfor WASI to returnlibc::STDIN_FILENOinstead ofsys::stdio::Stdin.as_raw_fd()(andsimilar for
StdoutandStderr), which matches how theunixversion works.
STDIN_FILENOetc. may not always be explicitlyreserved at the WASI level, but as long as we have Rust's
stdandlibc, I think it's reasonable to guarantee that we'll always uselibc::STDIN_FILENOfor stdin.This duplicates the
osstr2strutility function, rather thantrying to share it across all the configurations that need it.
r? @alexcrichton