Skip to content

Commit 4097009

Browse files
committed
fix compilation on uefi
1 parent 0bb4c96 commit 4097009

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl fmt::Debug for Error {
134134
let mut dbg = f.debug_struct("Error");
135135
if let Some(errno) = self.raw_os_error() {
136136
dbg.field("os_error", &errno);
137-
#[cfg(feature = "std")]
137+
#[cfg(all(feature = "std", not(target_os = "uefi")))]
138138
dbg.field("description", &std::io::Error::from_raw_os_error(errno));
139139
} else if let Some(desc) = self.internal_desc() {
140140
dbg.field("internal_code", &self.0.get());
@@ -150,7 +150,7 @@ impl fmt::Display for Error {
150150
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
151151
if let Some(errno) = self.raw_os_error() {
152152
cfg_if! {
153-
if #[cfg(feature = "std")] {
153+
if #[cfg(all(feature = "std", not(target_os = "uefi")))] {
154154
std::io::Error::from_raw_os_error(errno).fmt(f)
155155
} else {
156156
write!(f, "OS Error: {}", errno)

src/error_std_impls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ use std::io;
55

66
impl From<Error> for io::Error {
77
fn from(err: Error) -> Self {
8+
#[cfg(not(target_os = "uefi"))]
89
match err.raw_os_error() {
910
Some(errno) => io::Error::from_raw_os_error(errno),
1011
None => io::Error::new(io::ErrorKind::Other, err),
1112
}
13+
#[cfg(target_os = "uefi")]
14+
{
15+
io::Error::new(io::ErrorKind::Other, err)
16+
}
1217
}
1318
}
1419

0 commit comments

Comments
 (0)