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

Closed
16 of 18 tasks
sunfishcode opened this issue Jun 21, 2022 · 14 comments
Closed
16 of 18 tasks

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

sunfishcode opened this issue Jun 21, 2022 · 14 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.

@atouchet
Copy link

Mio 1.0 with I/O safety traits is now out: https://github.com/tokio-rs/mio/blob/master/CHANGELOG.md#10

@polarathene
Copy link

polarathene commented Jul 23, 2024

I assume that's been resolved as well, the current tokio MSRV is 1.70, while the msrv note was added in Aug 13 2022.

async-std still has not had a new release, nor any request for one. So I raised an issue for that.

@sunfishcode
Copy link
Owner Author

Thanks, it appears tokio is indeed updated.

@polarathene
Copy link

There was an issue with how the PR was implemented, someone will need to correct that for this item to move forward: async-rs/async-std#1036 (comment)

Presently a blocker for async-rs/async-std#1081

@sunfishcode
Copy link
Owner Author

I've now submitted async-rs/async-std#1084 to fix the errors in async-std.

@sunfishcode
Copy link
Owner Author

async-std 1.13 is now released with support for the traits.

eminence/terminal-size#66 is now posted to update terminal_size.

That will be the last checkbox left, other than the "TODO: add others here" boxes. Does anyone following this issue have any other crates in mind that we should update?

@sunfishcode
Copy link
Owner Author

terminal-size 0.4.0 is now released with an API that uses AsFd.

I don't have any other "others" to add here, and all the rest of the boxes here are checked, so I think it's time to close this issue! Thanks to everyone who had a hand in this!

If you have a codebase which is not yet migrated to the I/O safety types and traits and would like help migrating it, feel free to ping me and I'll help if I'm able to.

@solomoncyj
Copy link

can somone help https://github.com/wez/wezterm/ to migrte? thanks

@sunfishcode
Copy link
Owner Author

I'm too busy to get to this soon, but I filed #75 to track porting wezterm. I'd be happy to give people pointers if anyone is interested in working on this before I get to it.

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

7 participants