We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 09d52bc commit 940e0b3Copy full SHA for 940e0b3
library/std/src/sys/windows/compat.rs
@@ -103,20 +103,21 @@ macro_rules! compat_fn {
103
104
#[allow(dead_code)]
105
pub fn option() -> Option<F> {
106
- unsafe { PTR }
+ unsafe {
107
+ if cfg!(miri) {
108
+ // Miri does not run `init`, so we just call `get_f` each time.
109
+ get_f()
110
+ } else {
111
+ PTR
112
+ }
113
114
}
115
116
117
pub unsafe fn call($($argname: $argtype),*) -> $rettype {
- if let Some(ptr) = PTR {
118
+ if let Some(ptr) = option() {
119
return ptr($($argname),*);
120
- if cfg!(miri) {
- // Miri does not run `init`, so we just call `get_f` each time.
- if let Some(ptr) = get_f() {
- return ptr($($argname),*);
- }
121
$fallback_body
122
123
0 commit comments