From 8e8a5126b2489c84a1ba8552e04abace039cbb8e Mon Sep 17 00:00:00 2001 From: DarumaDocker Date: Wed, 27 Nov 2024 06:25:48 +0000 Subject: [PATCH] fix(wasi): Add back unsafe block for clockid_t static variables --- src/wasi/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index e07e46fe9d55..55b4be1291b3 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -384,15 +384,17 @@ cfg_if! { } else { // unsafe code here is required in the stable, but not in nightly #[allow(unused_unsafe)] - pub static CLOCK_MONOTONIC: clockid_t = clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)); + pub static CLOCK_MONOTONIC: clockid_t = + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) }; #[allow(unused_unsafe)] pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = - clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)); + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; #[allow(unused_unsafe)] - pub static CLOCK_REALTIME: clockid_t = clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)); + pub static CLOCK_REALTIME: clockid_t = + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) }; #[allow(unused_unsafe)] pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = - clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)); + unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; } }