Skip to content

Commit 8e8a512

Browse files
committed
fix(wasi): Add back unsafe block for clockid_t static variables
1 parent 511e3f2 commit 8e8a512

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/wasi/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,17 @@ cfg_if! {
384384
} else {
385385
// unsafe code here is required in the stable, but not in nightly
386386
#[allow(unused_unsafe)]
387-
pub static CLOCK_MONOTONIC: clockid_t = clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC));
387+
pub static CLOCK_MONOTONIC: clockid_t =
388+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_MONOTONIC)) };
388389
#[allow(unused_unsafe)]
389390
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
390-
clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID));
391+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
391392
#[allow(unused_unsafe)]
392-
pub static CLOCK_REALTIME: clockid_t = clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME));
393+
pub static CLOCK_REALTIME: clockid_t =
394+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_REALTIME)) };
393395
#[allow(unused_unsafe)]
394396
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
395-
clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID));
397+
unsafe { clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
396398
}
397399
}
398400

0 commit comments

Comments
 (0)