Skip to content

Commit

Permalink
Rollup merge of #99984 - ChrisDenton:fix-miri, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Fix compat.rs for `cfg(miri)`

Fixes #99982
  • Loading branch information
matthiaskrgr committed Jul 31, 2022
2 parents 0c3989e + bf0b18e commit e4fcee5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/std/src/sys/windows/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}
}
Expand Down

0 comments on commit e4fcee5

Please sign in to comment.