Skip to content

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

@newpavlov

Description

@newpavlov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions