Skip to content

Commit

Permalink
addr_of!(EXTERN_STATIC) is now considered safe
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet authored and myl7 committed Aug 5, 2024
1 parent dd4a81a commit 4e83dec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/wasi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,14 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_IOV_MAX: c_int = 60;
pub const _SC_SYMLOOP_MAX: c_int = 173;

#[allow(unused_unsafe)] // `addr_of!(EXTERN_STATIC)` is now considered safe
pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
#[allow(unused_unsafe)]
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
#[allow(unused_unsafe)]
pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
#[allow(unused_unsafe)]
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };

Expand Down

0 comments on commit 4e83dec

Please sign in to comment.