Skip to content

Commit 3d55f38

Browse files
committed
fix compilation of time/hermit.rs
rust-lang#154518 has broken compiling std for Hermit by unwrapping an `i32`. This commit converts the `i32` to an `io::Result` before unwrapping.
1 parent 80ad557 commit 3d55f38

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

library/std/src/sys/time/hermit.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use hermit_abi::{self, CLOCK_MONOTONIC, CLOCK_REALTIME};
22

33
use crate::io;
4+
use crate::sys::cvt;
45
use crate::sys::pal::time::Timespec;
56
use crate::time::Duration;
67

78
fn clock_gettime(clock: hermit_abi::clockid_t) -> Timespec {
89
let mut t = hermit_abi::timespec { tv_sec: 0, tv_nsec: 0 };
9-
unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }.unwrap();
10+
cvt(unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }).unwrap();
1011
Timespec::new(t.tv_sec, t.tv_nsec.into()).unwrap()
1112
}
1213

0 commit comments

Comments
 (0)