about summary refs log tree commit diff
path: root/library/std/src/sys/windows
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-07-31 23:39:44 +0200
committerGitHub <noreply@github.com>2022-07-31 23:39:44 +0200
commite4fcee579ea33fb2b38ddb947850d5ee612e6479 (patch)
tree11f01f1e61594c765db1811d425c8dfa8014ab8d /library/std/src/sys/windows
parent0c3989e556b882622aa326cecd267e1306807776 (diff)
parentbf0b18e91005d22081b5122c4dba8ee7f1c108d5 (diff)
downloadrust-e4fcee579ea33fb2b38ddb947850d5ee612e6479.tar.gz
rust-e4fcee579ea33fb2b38ddb947850d5ee612e6479.zip
Rollup merge of #99984 - ChrisDenton:fix-miri, r=Mark-Simulacrum
Fix compat.rs for `cfg(miri)`

Fixes #99982
Diffstat (limited to 'library/std/src/sys/windows')
-rw-r--r--library/std/src/sys/windows/compat.rs10
1 files changed, 5 insertions, 5 deletions
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 @@ 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);
                     }
                 }