New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AsFd implementations for stdio lock types on WASI.
#101768
base: master
Are you sure you want to change the base?
Add AsFd implementations for stdio lock types on WASI.
#101768
Conversation
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
|
(rust-highfive has picked a reviewer for you, use r? to override) |
|
@bors r+ |
|
@bors r- Are you sure this actually compiles on wasi? I don't see where StdinLock (or the other types) is imported in that module, maybe just missing something obvious. (Went to go look for stability implications of this change) |
This mirrors the implementations on Unix platforms, and also mirrors the existing `AsRawFd` impls. This is similar to rust-lang#100892, but is for the `*Lock` types.
d8c2c42
to
6acf998
Compare
6acf998
to
e97755c
Compare
|
@Mark-Simulacrum Ah, you're right. That's now fixed, and as you mention, the compiler required stability attributes. I marked them "stable", using the io_safety feature, on the theory that implementing |
|
Hm, ok. If these are stable surface area then they need a libs-api FCP; r? @joshtriplett |
|
@rfcbot merge |
|
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
|
|
| impl<'a> AsFd for io::StdinLock<'a> { | ||
| #[inline] | ||
| fn as_fd(&self) -> BorrowedFd<'_> { | ||
| unsafe { BorrowedFd::borrow_raw(0) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly is this correct? A safety comment here would be great to have for someone stumbling upon this without having prior knowledge of the API and WASI spec
This mirrors the implementations on Unix platforms, and also mirrors the existing
AsRawFdimpls.This is similar to #100892, but is for the
*Locktypes.