Auto merge of #129521 - matthiaskrgr:rollup-uigv77m, r=matthiaskrgr · patricklam/verify-rust-std@8dafd33

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -193,6 +193,7 @@

193193

// Language features:

194194

// tidy-alphabetical-start

195195

#![cfg_attr(bootstrap, feature(asm_const))]

196+

#![cfg_attr(bootstrap, feature(const_fn_floating_point_arithmetic))]

196197

#![cfg_attr(bootstrap, feature(min_exhaustive_patterns))]

197198

#![feature(abi_unadjusted)]

198199

#![feature(adt_const_params)]

@@ -202,7 +203,6 @@

202203

#![feature(cfg_sanitize)]

203204

#![feature(cfg_target_has_atomic)]

204205

#![feature(cfg_target_has_atomic_equal_alignment)]

205-

#![feature(const_fn_floating_point_arithmetic)]

206206

#![feature(const_for)]

207207

#![feature(const_mut_refs)]

208208

#![feature(const_precise_live_drops)]

Original file line numberDiff line numberDiff line change

@@ -1097,7 +1097,6 @@ pub mod effects {

10971097

pub trait TyCompat<T: ?Sized> {}

10981098
10991099

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

1100-

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

11011100

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

11021101
11031102

#[lang = "EffectsIntersection"]

Original file line numberDiff line numberDiff line change

@@ -2130,6 +2130,33 @@ pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool {

21302130

(p as *const ()) == (q as *const ())

21312131

}

21322132
2133+

/// Compares the *addresses* of the two function pointers for equality.

2134+

///

2135+

/// Function pointers comparisons can have surprising results since

2136+

/// they are never guaranteed to be unique and could vary between different

2137+

/// code generation units. Furthermore, different functions could have the

2138+

/// same address after being merged together.

2139+

///

2140+

/// This is the same as `f == g` but using this function makes clear

2141+

/// that you are aware of these potentially surprising semantics.

2142+

///

2143+

/// # Examples

2144+

///

2145+

/// ```

2146+

/// #![feature(ptr_fn_addr_eq)]

2147+

/// use std::ptr;

2148+

///

2149+

/// fn a() { println!("a"); }

2150+

/// fn b() { println!("b"); }

2151+

/// assert!(!ptr::fn_addr_eq(a as fn(), b as fn()));

2152+

/// ```

2153+

#[unstable(feature = "ptr_fn_addr_eq", issue = "129322")]

2154+

#[inline(always)]

2155+

#[must_use = "function pointer comparison produces a value"]

2156+

pub fn fn_addr_eq<T: FnPtr, U: FnPtr>(f: T, g: U) -> bool {

2157+

f.addr() == g.addr()

2158+

}

2159+
21332160

/// Hash a raw pointer.

21342161

///

21352162

/// This can be used to hash a `&T` reference (which coerces to `*const T` implicitly)

Original file line numberDiff line numberDiff line change

@@ -275,7 +275,7 @@ fn default_hook(info: &PanicHookInfo<'_>) {

275275

if cfg!(miri) {

276276

let _ = writeln!(

277277

err,

278-

"note: in Miri, you may have to set `-Zmiri-env-forward=RUST_BACKTRACE` \

278+

"note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` \

279279

for the environment variable to have an effect"

280280

);

281281

}