Skip to content

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

Closed

Description

@sunfishcode

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.

Activity

  1. pinned this issue on Aug 5, 2022
  2. notgull commented on Aug 12, 2022

    @notgull

    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.

  3. Thomasdezeeuw commented on Aug 12, 2022

    @Thomasdezeeuw
    Contributor

    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.

  4. notgull commented on Aug 14, 2022

    @notgull

    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.

  5. joshtriplett commented on Aug 21, 2022

    @joshtriplett
    Contributor

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

  6. sunfishcode commented on Aug 23, 2022

    @sunfishcode
    OwnerAuthor

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

  7. atouchet commented on Jul 23, 2024

    @atouchet

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

  8. polarathene commented on Jul 23, 2024

    @polarathene

    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.

  9. sunfishcode commented on Aug 15, 2024

    @sunfishcode
    OwnerAuthor

    Thanks, it appears tokio is indeed updated.

  10. polarathene commented on Aug 20, 2024

    @polarathene

    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

  11. sunfishcode commented on Aug 21, 2024

    @sunfishcode
    OwnerAuthor

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

  12. sunfishcode commented on Sep 9, 2024

    @sunfishcode
    OwnerAuthor

    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?

  13. sunfishcode commented on Sep 25, 2024

    @sunfishcode
    OwnerAuthor

    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.

  14. unpinned this issue on Sep 25, 2024
  15. solomoncyj commented on Oct 20, 2024

    @solomoncyj

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

  16. sunfishcode commented on Nov 4, 2024

    @sunfishcode
    OwnerAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions