Skip to content

Commit bf0b18e

Browse files
committed
Make sure symbol_name is const evaluated
1 parent 7f3d11e commit bf0b18e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/std/src/sys/windows/compat.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ macro_rules! compat_fn_with_fallback {
180180

181181
fn load_from_module(module: Option<Module>) -> F {
182182
unsafe {
183-
static symbol_name: &CStr = ansi_str!(sym $symbol);
184-
if let Some(f) = module.and_then(|m| m.proc_address(symbol_name)) {
183+
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
184+
if let Some(f) = module.and_then(|m| m.proc_address(SYMBOL_NAME)) {
185185
PTR.store(f.as_ptr(), Ordering::Relaxed);
186186
mem::transmute(f)
187187
} else {
@@ -262,8 +262,8 @@ macro_rules! compat_fn_optional {
262262
#[allow(unused)]
263263
pub(in crate::sys) fn preload(module: Module) {
264264
unsafe {
265-
let symbol_name = ansi_str!(sym $symbol);
266-
if let Some(f) = module.proc_address(symbol_name) {
265+
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
266+
if let Some(f) = module.proc_address(SYMBOL_NAME) {
267267
PTR.store(f.as_ptr(), Ordering::Relaxed);
268268
}
269269
}

0 commit comments

Comments
 (0)