Rollup merge of #99984 - ChrisDenton:fix-miri, r=Mark-Simulacrum
Fix compat.rs for `cfg(miri)` Fixes #99982
This commit is contained in:
commit
e4fcee579e
1 changed files with 5 additions and 5 deletions
|
@ -180,8 +180,8 @@ macro_rules! compat_fn_with_fallback {
|
|||
|
||||
fn load_from_module(module: Option<Module>) -> F {
|
||||
unsafe {
|
||||
static symbol_name: &CStr = ansi_str!(sym $symbol);
|
||||
if let Some(f) = module.and_then(|m| m.proc_address(symbol_name)) {
|
||||
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
|
||||
if let Some(f) = module.and_then(|m| m.proc_address(SYMBOL_NAME)) {
|
||||
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
||||
mem::transmute(f)
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ macro_rules! compat_fn_optional {
|
|||
pub fn option() -> Option<F> {
|
||||
let mut func = NonNull::new(PTR.load(Ordering::Relaxed));
|
||||
if func.is_none() {
|
||||
Module::new($module).map(preload);
|
||||
unsafe { Module::new($module).map(preload) };
|
||||
func = NonNull::new(PTR.load(Ordering::Relaxed));
|
||||
}
|
||||
unsafe {
|
||||
|
@ -262,8 +262,8 @@ macro_rules! compat_fn_optional {
|
|||
#[allow(unused)]
|
||||
pub(in crate::sys) fn preload(module: Module) {
|
||||
unsafe {
|
||||
let symbol_name = ansi_str!(sym $symbol);
|
||||
if let Some(f) = module.proc_address(symbol_name) {
|
||||
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
|
||||
if let Some(f) = module.proc_address(SYMBOL_NAME) {
|
||||
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue