Skip to content

Commit cbd4323

Browse files
DarumaDockertgross35
authored andcommitted
fix(wasi): Add back unsafe block for clockid_t static variables
(backport <#4157>) (cherry picked from commit 8e8a512)
1 parent d9a59db commit cbd4323

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
// `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
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)