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