rust/library/std
bors 5a3e2a4e92 Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum
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
2024-06-24 15:55:28 +00:00
..
benches also test parts of std 2024-04-07 10:05:57 +02:00
src Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum 2024-06-24 15:55:28 +00:00
tests Add blank lines after module-level //! comments. 2024-06-20 09:23:20 +10:00
build.rs Move some expected cfgs to std build.rs as per Cargo recommandation 2024-05-23 16:08:31 +02:00
Cargo.toml add HermitOS support of vectored read/write operations 2024-06-07 20:48:30 +02:00