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

Error on targets where RawOsError is not equal to i32 #568

Open
newpavlov opened this issue Dec 18, 2024 · 0 comments · Fixed by #569
Open

Error on targets where RawOsError is not equal to i32 #568

newpavlov opened this issue Dec 18, 2024 · 0 comments · Fixed by #569

Comments

@newpavlov
Copy link
Member

newpavlov commented Dec 18, 2024

Previously, all Rust targets with std were using i32 for "raw" OS error codes, i.e. io::Error::raw_os_error/from_raw_os_error have accepted i32. We have encoded this assumption in Error::raw_os_error, fmt::Debug/Display, and From<Error> for io::Error implementations.

But in the recently added UEFI std implementation usize is used for error codes instead as per UEFI spec. It's reflected by the new (Nightly-only) type alias RawOsError

For now, we just added cfg-based exceptions for UEFI targets in the relevant internal implementations (see #566). But it may be worth to reconsider our use of NonZeroU32 for Error internal representation and return type of Error::raw_os_error.

cc @usamoi

newpavlov added a commit that referenced this issue Dec 18, 2024
This allows us to remove some UEFI-specific exceptions from the code.

This PR only partially resolves #568 since we still use `NonZeroU32` on
UEFI targets, but it should be sufficient to future-proof ourselves for
the v0.3 release.
@newpavlov newpavlov reopened this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant