From eec058eacc1ba500aba4393dbec47a1acd6e2d2a Mon Sep 17 00:00:00 2001 From: joboet Date: Thu, 15 Jan 2026 15:21:58 +0100 Subject: [PATCH] std: move time implementations to `sys` (WASI/TEEOS) WASI and TEEOS share the UNIX implementation. Since `Timespec` lives in the PAL, this means that the `#[path]` imports of `unix/time.rs` still remain for these two, unfortunately. Maybe we'll solve that in the future by always including the UNIX PAL for these remotely UNIXy platforms. But that's a story for another time... --- library/std/src/sys/pal/teeos/mod.rs | 1 - library/std/src/sys/time/mod.rs | 10 +++++++++- library/std/src/sys/time/unix.rs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/library/std/src/sys/pal/teeos/mod.rs b/library/std/src/sys/pal/teeos/mod.rs index d40c10663fd1..f76c26d3c966 100644 --- a/library/std/src/sys/pal/teeos/mod.rs +++ b/library/std/src/sys/pal/teeos/mod.rs @@ -7,7 +7,6 @@ #![allow(dead_code)] pub mod os; -#[allow(non_upper_case_globals)] #[path = "../unix/time.rs"] pub mod time; diff --git a/library/std/src/sys/time/mod.rs b/library/std/src/sys/time/mod.rs index 3efab78518c2..6cd1850e7cca 100644 --- a/library/std/src/sys/time/mod.rs +++ b/library/std/src/sys/time/mod.rs @@ -1,4 +1,8 @@ cfg_select! { + target_os = "hermit" => { + mod hermit; + use hermit as imp; + } target_os = "motor" => { use moto_rt::time as imp; } @@ -14,7 +18,11 @@ cfg_select! { mod uefi; use uefi as imp; } - target_family = "unix" => { + any( + target_os = "teeos", + target_family = "unix", + target_os = "wasi", + ) => { mod unix; use unix as imp; } diff --git a/library/std/src/sys/time/unix.rs b/library/std/src/sys/time/unix.rs index 21d246bc850a..944cb552cad9 100644 --- a/library/std/src/sys/time/unix.rs +++ b/library/std/src/sys/time/unix.rs @@ -15,7 +15,7 @@ impl SystemTime { pub const MIN: SystemTime = SystemTime { t: Timespec::MIN }; - #[cfg_attr(any(target_os = "horizon", target_os = "hurd"), allow(unused))] + #[cfg_attr(any(target_os = "horizon", target_os = "hurd", target_os = "teeos"), expect(unused))] pub fn new(tv_sec: i64, tv_nsec: i64) -> Result { Ok(SystemTime { t: Timespec::new(tv_sec, tv_nsec)? }) }