Description
Feature gate: #![feature(raw_os_error_ty)]
This is a tracking issue for the raw OS error type alias, used in io::Error::raw_os_error
and io::Error::from_raw_os_error
(both are stable APIs).
std
used to assume that the OS error type (return by errno
and such) is an i32
. This is however not the case on platforms like UEFI (which uses usize
). To ensure idiomatic and convenient handling of native errors without loosing information, the RawOsError
type is introduced to allow future ports of the standard library to use the correct error type for their respective platform. As this does not change the error type on already supported targets, this is a backwards-compatible change. Current software can still use i32
directly while the RawOsError
type alias is unstable. However, this feature should probably be stabilized before ports using a different type are merged, to allow software to be more easily ported.
Public API
// std::io
pub type RawOsError = /* platform error type, `i32` most of the time */;
Steps / History
- API change proposal: Add type alias for raw OS errors libs-team#173
- Implementation: Add type alias for raw OS errors #107519
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- None yet.