Skip to content

Commit

Permalink
Auto merge of rust-lang#129521 - matthiaskrgr:rollup-uigv77m, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#128596 (stabilize const_fn_floating_point_arithmetic)
 - rust-lang#129199 (make writes_through_immutable_pointer a hard error)
 - rust-lang#129246 (Retroactively feature gate `ConstArgKind::Path`)
 - rust-lang#129290 (Pin `cc` to 1.0.105)
 - rust-lang#129323 (Implement `ptr::fn_addr_eq`)
 - rust-lang#129500 (remove invalid `TyCompat` relation for effects)
 - rust-lang#129501 (panicking: improve hint for Miri's RUST_BACKTRACE behavior)
 - rust-lang#129505 (interpret: ImmTy: tighten sanity checks in offset logic)
 - rust-lang#129510 (Fix `elided_named_lifetimes` in code)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Aug 25, 2024
2 parents c14cf57 + 0fe3746 commit 8dafd33
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
// Language features:
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(asm_const))]
#![cfg_attr(bootstrap, feature(const_fn_floating_point_arithmetic))]
#![cfg_attr(bootstrap, feature(min_exhaustive_patterns))]
#![feature(abi_unadjusted)]
#![feature(adt_const_params)]
Expand All @@ -202,7 +203,6 @@
#![feature(cfg_sanitize)]
#![feature(cfg_target_has_atomic)]
#![feature(cfg_target_has_atomic_equal_alignment)]
#![feature(const_fn_floating_point_arithmetic)]
#![feature(const_for)]
#![feature(const_mut_refs)]
#![feature(const_precise_live_drops)]
Expand Down
1 change: 0 additions & 1 deletion core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ pub mod effects {
pub trait TyCompat<T: ?Sized> {}

impl<T: ?Sized> TyCompat<T> for T {}
impl<T: ?Sized> TyCompat<T> for Maybe {}
impl<T: ?Sized> TyCompat<Maybe> for T {}

#[lang = "EffectsIntersection"]
Expand Down
27 changes: 27 additions & 0 deletions core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,33 @@ pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool {
(p as *const ()) == (q as *const ())
}

/// Compares the *addresses* of the two function pointers for equality.
///
/// Function pointers comparisons can have surprising results since
/// they are never guaranteed to be unique and could vary between different
/// code generation units. Furthermore, different functions could have the
/// same address after being merged together.
///
/// This is the same as `f == g` but using this function makes clear
/// that you are aware of these potentially surprising semantics.
///
/// # Examples
///
/// ```
/// #![feature(ptr_fn_addr_eq)]
/// use std::ptr;
///
/// fn a() { println!("a"); }
/// fn b() { println!("b"); }
/// assert!(!ptr::fn_addr_eq(a as fn(), b as fn()));
/// ```
#[unstable(feature = "ptr_fn_addr_eq", issue = "129322")]
#[inline(always)]
#[must_use = "function pointer comparison produces a value"]
pub fn fn_addr_eq<T: FnPtr, U: FnPtr>(f: T, g: U) -> bool {
f.addr() == g.addr()
}

/// Hash a raw pointer.
///
/// This can be used to hash a `&T` reference (which coerces to `*const T` implicitly)
Expand Down
2 changes: 1 addition & 1 deletion std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ fn default_hook(info: &PanicHookInfo<'_>) {
if cfg!(miri) {
let _ = writeln!(
err,
"note: in Miri, you may have to set `-Zmiri-env-forward=RUST_BACKTRACE` \
"note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` \
for the environment variable to have an effect"
);
}
Expand Down

0 comments on commit 8dafd33

Please sign in to comment.