Skip to content
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

Quest: Gradually migrate the Rust ecosystem to I/O safety #38

Open
12 of 18 tasks
sunfishcode opened this issue Jun 21, 2022 · 5 comments
Open
12 of 18 tasks

Quest: Gradually migrate the Rust ecosystem to I/O safety #38

sunfishcode opened this issue Jun 21, 2022 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sunfishcode
Copy link
Owner

sunfishcode commented Jun 21, 2022

As mentioned in the RFC, migration to I/O safety will be a gradual process. I'm laying out a roadmap here, with todo items, to help organize the process. If anyone is interested in helping with any of the items in this process, has ideas of things we should add, or has any questions about anything, please post in this issue! I'll add names to the todo items to track who's working on what.

The first steps are:

Once the feature reaches stable, the next step will be to contribute AsFd, From<OwnedFd> and From<T> for OwnedFd impls to popular types in the ecosystem. These changes are semver compatible, though they do have MSRV considerations.

To help crates that are already using io-lifetimes, such as rustix:

Once "enough" popular types have added the new impls, we can start migrating APIs to use the new traits, such as using AsFd in place of AsRawFd. When doing so, any functions that accept raw file-descriptor arguments should be changed to unsafe as well. These changes may require a semver bump. They may require a Minimum Supported Rust Version bump too, though another option is to use io-lifetimes once the change to have it re-export std's types and traits by default lands.

@notgull
Copy link

notgull commented Aug 12, 2022

It is unlikely that mio/tokio will update to use I/O safety soon, as they don't want to put it behind a feature flag and their MSRV policy is for the version to be out for at least six months before considering it.

@Thomasdezeeuw
Copy link

It is unlikely that mio/tokio will update to use I/O safety soon, as they don't want to put it behind a feature flag and their MSRV policy is for the version to be out for at least six months before considering it.

The same goes for socket2, feature flags aren't the way to do this. We could go with a build.rs file, e.g. like serde, but I rather just bump the MSRV in a new version. Also note that we have rust-lang/libc#2845 going at the same time, so a ecosystem wide bump of the MSRV seems to be on the horizon.

@notgull
Copy link

notgull commented Aug 14, 2022

Since it's not linked in the original post: new traits have been added to socket2 in rust-lang/socket2#325, not only in the form of impls of the traits, but also bounding Into<SockRef> by AsFd/Socket.

@joshtriplett
Copy link
Contributor

We should also aim to get std::os::fd stabilized, to make migration easier and avoid extra cfg branches for wasi.

@sunfishcode
Copy link
Owner Author

The PR for that is rust-lang/rust#98368.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants