diff --git a/rand_core/src/os.rs b/rand_core/src/os.rs index 49111632d9..dc4125c960 100644 --- a/rand_core/src/os.rs +++ b/rand_core/src/os.rs @@ -66,6 +66,14 @@ impl std::error::Error for OsError { } } +// If [`RawOsError`](https://doc.rust-lang.org/std/io/type.RawOsError.html) is stablized, we can use it. + +#[cfg(not(target_os = "uefi"))] +type RawOsError = i32; + +#[cfg(target_os = "uefi")] +type RawOsError = usize; + impl OsError { /// Extract the raw OS error code (if this error came from the OS) /// @@ -75,7 +83,7 @@ impl OsError { /// /// [1]: https://doc.rust-lang.org/std/io/struct.Error.html#method.raw_os_error #[inline] - pub fn raw_os_error(self) -> Option { + pub fn raw_os_error(self) -> Option { self.0.raw_os_error() } }