diff --git a/build.rs b/build.rs index 78ed993441d53..15bf2f5a8cb16 100644 --- a/build.rs +++ b/build.rs @@ -18,7 +18,6 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ "libc_const_extern_fn_unstable", "libc_deny_warnings", "libc_long_array", - "libc_ptr_addr_of", "libc_thread_local", "libc_underscore_const_names", "libc_ctest", @@ -87,10 +86,6 @@ fn main() { set_cfg("libc_long_array"); } - if rustc_minor_ver >= 51 || rustc_dep_of_std { - set_cfg("libc_ptr_addr_of"); - } - // Rust >= 1.37.0 allows underscores as anonymous constant names. if rustc_minor_ver >= 37 || rustc_dep_of_std { set_cfg("libc_underscore_const_names"); diff --git a/src/macros.rs b/src/macros.rs index 6d728d078d85f..cb77cc6c2e822 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -311,17 +311,3 @@ macro_rules! deprecated_mach { )* } } - -#[cfg(not(libc_ptr_addr_of))] -macro_rules! ptr_addr_of { - ($place:expr) => { - &$place - }; -} - -#[cfg(libc_ptr_addr_of)] -macro_rules! ptr_addr_of { - ($place:expr) => { - ::core::ptr::addr_of!($place) - }; -} diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index b157ab0d59b04..980cda9740ea4 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -380,16 +380,16 @@ cfg_if! { // `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82 #[allow(unused_unsafe)] pub static CLOCK_MONOTONIC: clockid_t = - unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; + clockid_t(core::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)) }; + clockid_t(core::ptr::addr_of!(_CLOCK_PROCESS_CPUTIME_ID)); #[allow(unused_unsafe)] pub static CLOCK_REALTIME: clockid_t = - unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) }; + clockid_t(core::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)) }; + clockid_t(core::ptr::addr_of!(_CLOCK_THREAD_CPUTIME_ID)); } }