Skip to content

Commit 855570b

Browse files
committed
fix compilation on uefi targets
Signed-off-by: usamoi <[email protected]>
1 parent 4cbd428 commit 855570b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

rand_core/src/os.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ impl std::error::Error for OsError {
6666
}
6767
}
6868

69+
// If [`RawOsError`](https://doc.rust-lang.org/std/io/type.RawOsError.html) is stablized, we can use it.
70+
71+
#[cfg(not(target_os = "uefi"))]
72+
type RawOsError = i32;
73+
74+
#[cfg(target_os = "uefi")]
75+
type RawOsError = usize;
76+
6977
impl OsError {
7078
/// Extract the raw OS error code (if this error came from the OS)
7179
///
@@ -75,7 +83,7 @@ impl OsError {
7583
///
7684
/// [1]: https://doc.rust-lang.org/std/io/struct.Error.html#method.raw_os_error
7785
#[inline]
78-
pub fn raw_os_error(self) -> Option<i32> {
86+
pub fn raw_os_error(self) -> Option<RawOsError> {
7987
self.0.raw_os_error()
8088
}
8189
}

0 commit comments

Comments
 (0)