mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #98042 - DrMeepster:winfred_std_changes, r=ChrisDenton
Fix compat_fn option method on miri This change is required to make `WaitOnAddress` work with rust-lang/miri#2231
This commit is contained in:
commit
e565541824
@ -102,21 +102,23 @@ macro_rules! compat_fn {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[inline(always)]
|
||||
pub fn option() -> Option<F> {
|
||||
unsafe { PTR }
|
||||
unsafe {
|
||||
if cfg!(miri) {
|
||||
// Miri does not run `init`, so we just call `get_f` each time.
|
||||
get_f()
|
||||
} else {
|
||||
PTR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub unsafe fn call($($argname: $argtype),*) -> $rettype {
|
||||
if let Some(ptr) = PTR {
|
||||
if let Some(ptr) = option() {
|
||||
return ptr($($argname),*);
|
||||
}
|
||||
if cfg!(miri) {
|
||||
// Miri does not run `init`, so we just call `get_f` each time.
|
||||
if let Some(ptr) = get_f() {
|
||||
return ptr($($argname),*);
|
||||
}
|
||||
}
|
||||
$fallback_body
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user