diff options
| author | joboet <jonasboettiger@icloud.com> | 2024-06-15 17:47:35 +0200 | 
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2024-06-15 17:47:35 +0200 | 
| commit | f3facf11758af878bcfaf47fc773962dbb565024 (patch) | |
| tree | 81d1238932f3d528e11dcb2e8857fc5a39587164 /library/std/src/sys/pal/wasm/mod.rs | |
| parent | d2ad293851dc8e14a61355d0358490b77efae8cb (diff) | |
| download | rust-f3facf11758af878bcfaf47fc773962dbb565024.tar.gz rust-f3facf11758af878bcfaf47fc773962dbb565024.zip | |
std: refactor the TLS implementation
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
Diffstat (limited to 'library/std/src/sys/pal/wasm/mod.rs')
| -rw-r--r-- | library/std/src/sys/pal/wasm/mod.rs | 4 | 
1 files changed, 0 insertions, 4 deletions
| diff --git a/library/std/src/sys/pal/wasm/mod.rs b/library/std/src/sys/pal/wasm/mod.rs index 75dd10826cc..4c34859e918 100644 --- a/library/std/src/sys/pal/wasm/mod.rs +++ b/library/std/src/sys/pal/wasm/mod.rs @@ -34,10 +34,6 @@ pub mod pipe; pub mod process; #[path = "../unsupported/stdio.rs"] pub mod stdio; -#[path = "../unsupported/thread_local_dtor.rs"] -pub mod thread_local_dtor; -#[path = "../unsupported/thread_local_key.rs"] -pub mod thread_local_key; #[path = "../unsupported/time.rs"] pub mod time; | 
