Skip to content

Commit

Permalink
fix(wasi): Add back unsafe block for clockid_t static variables
Browse files Browse the repository at this point in the history
  • Loading branch information
DarumaDocker committed Nov 27, 2024
1 parent 511e3f2 commit 8e8a512
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) };
}
}

Expand Down

0 comments on commit 8e8a512

Please sign in to comment.