Skip to content

Commit 3fbaf78

Browse files
authored
Rollup merge of #110587 - tomaka:fix-109727, r=jyn514
Fix `std` compilation error for wasi+atomics Fix #109727 It seems that the `unsupported/once.rs` module isn't meant to exist at the same time as the `futex` module, as they have conflicting definitions. I've solved this by defining the `once` module only if `not(target_feature = "atomics")`. The `wasm32-unknown-unknown` target [similarly only defines the `once` module if `not(target_feature = "atomics")`](https://github.com/tomaka/rust/blob/01c4f319276da912dd2be768ae0ce9857ad6bb63/library/std/src/sys/wasm/mod.rs#L69-L70). As show in [this block of code](https://github.com/tomaka/rust/blob/01c4f319276da912dd2be768ae0ce9857ad6bb63/library/std/src/sys_common/once/mod.rs#L10-L34), the `sys::once` module doesn't need to exist if `all(target_arch = "wasm32", target_feature = "atomics")`.
2 parents 3163dfd + 01c4f31 commit 3fbaf78

File tree

1 file changed

+7
-2
lines changed
  • library/std/src/sys/wasi

1 file changed

+7
-2
lines changed

library/std/src/sys/wasi/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ pub mod io;
3232
#[path = "../unsupported/locks/mod.rs"]
3333
pub mod locks;
3434
pub mod net;
35-
#[path = "../unsupported/once.rs"]
36-
pub mod once;
3735
pub mod os;
3836
#[path = "../unix/os_str.rs"]
3937
pub mod os_str;
@@ -51,6 +49,13 @@ pub mod thread_local_dtor;
5149
pub mod thread_local_key;
5250
pub mod time;
5351

52+
cfg_if::cfg_if! {
53+
if #[cfg(not(target_feature = "atomics"))] {
54+
#[path = "../unsupported/once.rs"]
55+
pub mod once;
56+
}
57+
}
58+
5459
#[path = "../unsupported/common.rs"]
5560
#[deny(unsafe_op_in_unsafe_fn)]
5661
#[allow(unused)]

0 commit comments

Comments
 (0)