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
1 changed files with 10 additions and 8 deletions
|
@ -102,21 +102,23 @@ macro_rules! compat_fn {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[inline(always)]
|
||||||
pub fn option() -> Option<F> {
|
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)]
|
#[allow(dead_code)]
|
||||||
pub unsafe fn call($($argname: $argtype),*) -> $rettype {
|
pub unsafe fn call($($argname: $argtype),*) -> $rettype {
|
||||||
if let Some(ptr) = PTR {
|
if let Some(ptr) = option() {
|
||||||
return ptr($($argname),*);
|
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
|
$fallback_body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue