diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs index b4ffbdc9609..ccc90177a20 100644 --- a/library/std/src/sys/windows/compat.rs +++ b/library/std/src/sys/windows/compat.rs @@ -180,8 +180,8 @@ pub mod $symbol { fn load_from_module(module: Option) -> 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 @@ pub fn option() -> Option { pub fn option() -> Option { 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 @@ pub fn option() -> Option { #[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); } }