From dd905cd1118463d1ee4546f016199dad517f6ccb Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 10 Aug 2026 09:58:30 -0700 Subject: [PATCH] std: Adjust cfgs again for TLS on WASI This commit adjusts the changes made in 159733. A wasi-libc bug was discovered in 160828 which is present in certain situations which means that the changes in 159733 expose this bug. The purpose of this PR is to get wasip1/wasip2 targets fixed again while preserving a working implementation for wasip3. This upstream bug is already fixed in wasi-libc meaning that this PR won't be necessary once wasi-sdk-34 is published and used in rust-lang/rust. Until that time, however, this effectively reverts 159733 for wasip1/wasip2. The wasip3 target is Tier 3 still and requires wasi-sdk-34 anyway which is why that's left unchanged. Closes 160828 --- library/std/src/sys/thread_local/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs index cb954e475be1b..3ccfdd27ee833 100644 --- a/library/std/src/sys/thread_local/mod.rs +++ b/library/std/src/sys/thread_local/mod.rs @@ -25,7 +25,7 @@ cfg_select! { any( - all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi")), + all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3")), target_os = "uefi", target_os = "zkvm", target_os = "trusty", @@ -56,7 +56,7 @@ cfg_select! { /// single callback that runs all of the destructors in the list. #[cfg(all( target_thread_local, - not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_os = "wasi"))) + not(all(target_family = "wasm", not(target_feature = "atomics"), not(target_env = "p3"))) ))] pub(crate) mod destructors { cfg_select! { @@ -96,7 +96,7 @@ pub(crate) mod guard { pub(crate) use windows::enable; } any( - all(target_family = "wasm", not(target_os = "wasi")), + all(target_family = "wasm", not(target_env = "p3")), target_os = "uefi", target_os = "zkvm", target_os = "trusty", @@ -151,7 +151,7 @@ pub(crate) mod key { ), all(not(target_thread_local), target_vendor = "apple"), target_os = "teeos", - target_os = "wasi", + all(target_os = "wasi", target_env = "p3"), ) => { mod racy; mod unix;