From 3d55f38a7f40c71b07283efc204fa8c658d2201b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Thu, 2 Apr 2026 10:37:15 +0200 Subject: [PATCH] fix compilation of time/hermit.rs https://github.com/rust-lang/rust/pull/154518 has broken compiling std for Hermit by unwrapping an `i32`. This commit converts the `i32` to an `io::Result` before unwrapping. --- library/std/src/sys/time/hermit.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/std/src/sys/time/hermit.rs b/library/std/src/sys/time/hermit.rs index 4e8e5dfe21c8a..461319b162cc1 100644 --- a/library/std/src/sys/time/hermit.rs +++ b/library/std/src/sys/time/hermit.rs @@ -1,12 +1,13 @@ use hermit_abi::{self, CLOCK_MONOTONIC, CLOCK_REALTIME}; use crate::io; +use crate::sys::cvt; use crate::sys::pal::time::Timespec; use crate::time::Duration; fn clock_gettime(clock: hermit_abi::clockid_t) -> Timespec { let mut t = hermit_abi::timespec { tv_sec: 0, tv_nsec: 0 }; - unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }.unwrap(); + cvt(unsafe { hermit_abi::clock_gettime(clock, &raw mut t) }).unwrap(); Timespec::new(t.tv_sec, t.tv_nsec.into()).unwrap() }