about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2024-06-23 20:38:40 +0200
committerjoboet <jonasboettiger@icloud.com>2024-06-24 16:37:09 +0200
commit50a02ed789ed164f09d3ec8471f71c9c2b02df1d (patch)
tree12eb3bfe35b9bb9d2db31f4464e3b47d56216874 /library/std/src/sys
parent32f9b8bf7671407fc19d9635b7c71b8051b8c165 (diff)
downloadrust-50a02ed789ed164f09d3ec8471f71c9c2b02df1d.tar.gz
rust-50a02ed789ed164f09d3ec8471f71c9c2b02df1d.zip
std: fix wasm builds
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/thread_local/mod.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs
index a009ad5c33f..f74fd828cbe 100644
--- a/library/std/src/sys/thread_local/mod.rs
+++ b/library/std/src/sys/thread_local/mod.rs
@@ -83,8 +83,18 @@ mod guard {
             pub(super) use windows::enable;
         } else if #[cfg(any(
             all(target_family = "wasm", target_feature = "atomics"),
-            target_os = "hermit",
         ))] {
+            pub(super) fn enable() {
+                // FIXME: Right now there is no concept of "thread exit", but
+                // this is likely going to show up at some point in the form of
+                // an exported symbol that the wasm runtime is going to be
+                // expected to call. For now we just leak everything, but if
+                // such a function starts to exist it will probably need to
+                // iterate the destructor list with this function:
+                #[allow(unused)]
+                use super::destructors::run;
+            }
+        } else if #[cfg(target_os = "hermit")] {
             pub(super) fn enable() {}
         } else if #[cfg(target_os = "solid_asp3")] {
             mod solid;
@@ -105,7 +115,11 @@ mod guard {
 pub(crate) mod key {
     cfg_if::cfg_if! {
         if #[cfg(any(
-            all(not(target_vendor = "apple"), target_family = "unix"),
+            all(
+                not(target_vendor = "apple"),
+                not(target_family = "wasm"),
+                target_family = "unix",
+            ),
             target_os = "teeos",
         ))] {
             mod racy;