Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the ptr_addr_of conditional #4065

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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");
Expand Down
14 changes: 0 additions & 14 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
}
8 changes: 4 additions & 4 deletions src/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down