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

Use rustix abstraction to support I/O Safety unconditionally #135

Closed
wants to merge 1 commit into from

Conversation

joshtriplett
Copy link

rustix (via io-lifetimes) always provides the I/O Safety types and
traits. On newer Rust it re-exports them from the standard library; on
older Rust it defines its own. We already depend on those types (e.g.
rustix::fd::BorrowedFd) in our implementation.

Use the rustix types so that we can support I/O Safety unconditionally.

Note that on Windows, rustix exports BorrowedFd/OwnedFd types that
are really BorrowedSocket/OwnedSocket. Work around this in the
implementation by renaming them back.

rustix (via io-lifetimes) always provides the I/O Safety types and
traits. On newer Rust it re-exports them from the standard library; on
older Rust it defines its own. We already depend on those types (e.g.
`rustix::fd::BorrowedFd`) in our implementation.

Use the rustix types so that we can support I/O Safety unconditionally.

Note that on Windows, rustix exports `BorrowedFd`/`OwnedFd` types that
are really `BorrowedSocket`/`OwnedSocket`. Work around this in the
implementation by renaming them back.
Copy link
Member

@notgull notgull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

In less than a week from now, Debian Bookworm will release as the new Debian Stable, containing a rustc with version 1.63. This means that we can use this version as per our tentative MSRV policy (see smol-rs/smol#244). I would rather just wait and then use AsFd and friends from libstd, rather than re-export types from rustix, which tends to be very unstable.

@taiki-e
Copy link
Collaborator

taiki-e commented Jun 11, 2023

Closing in favor of #136

@taiki-e taiki-e closed this Jun 11, 2023
@joshtriplett joshtriplett deleted the rustix-types branch June 12, 2023 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants