diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-07-31 15:07:47 +0100 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-07-31 17:41:07 +0100 |
| commit | bf0b18e91005d22081b5122c4dba8ee7f1c108d5 (patch) | |
| tree | f5460ceb0d241de97e7b04d15cc3794d379fba25 | |
| parent | 7f3d11e1d8c8610894e8960116628f0b77b11cad (diff) | |
| download | rust-bf0b18e91005d22081b5122c4dba8ee7f1c108d5.tar.gz rust-bf0b18e91005d22081b5122c4dba8ee7f1c108d5.zip | |
Make sure `symbol_name` is const evaluated
| -rw-r--r-- | library/std/src/sys/windows/compat.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs index b8df46957a5..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 { @@ -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); } } |
