<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/library/std/src/sys/thread_local/guard/key.rs, branch 1.89.0</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=1.89.0</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=1.89.0'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-05-22T14:47:36+00:00</updated>
<entry>
<title>docs: fix typos</title>
<updated>2025-05-22T14:47:36+00:00</updated>
<author>
<name>Dannyyy93</name>
<email>dannymotydnd@gmail.com</email>
</author>
<published>2025-05-22T14:47:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d6dc08c3f4c32744c7163561da1a16825d1eed2d'/>
<id>urn:sha1:d6dc08c3f4c32744c7163561da1a16825d1eed2d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: make `thread::current` available in all `thread_local!` destructors</title>
<updated>2024-10-02T16:04:21+00:00</updated>
<author>
<name>joboet</name>
<email>jonasboettiger@icloud.com</email>
</author>
<published>2024-07-18T11:59:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d868fdce6b9ddef6abcc8de86b3ba8459def36a2'/>
<id>urn:sha1:d868fdce6b9ddef6abcc8de86b3ba8459def36a2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Reformat using the new identifier sorting from rustfmt</title>
<updated>2024-09-22T23:11:29+00:00</updated>
<author>
<name>Michael Goulet</name>
<email>michael@errs.io</email>
</author>
<published>2024-09-22T23:05:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c682aa162b0d41e21cc6748f4fecfe01efb69d1f'/>
<id>urn:sha1:c682aa162b0d41e21cc6748f4fecfe01efb69d1f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: separate TLS key creation from TLS access</title>
<updated>2024-06-25T16:30:49+00:00</updated>
<author>
<name>joboet</name>
<email>jonasboettiger@icloud.com</email>
</author>
<published>2024-06-25T16:30:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e8516f8b52d8ae49c2e0b2ff2cb5faf28b1a6526'/>
<id>urn:sha1:e8516f8b52d8ae49c2e0b2ff2cb5faf28b1a6526</id>
<content type='text'>
Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock&lt;Key&gt;`, allowing the reuse of the retreived key for multiple accesses.
</content>
</entry>
<entry>
<title>std: update TLS module documentation</title>
<updated>2024-06-17T13:58:06+00:00</updated>
<author>
<name>joboet</name>
<email>jonasboettiger@icloud.com</email>
</author>
<published>2024-06-17T13:58:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=35f050b8dafc19233f4ecfabd1ac4aa117a491b9'/>
<id>urn:sha1:35f050b8dafc19233f4ecfabd1ac4aa117a491b9</id>
<content type='text'>
</content>
</entry>
<entry>
<title>std: refactor the TLS implementation</title>
<updated>2024-06-15T15:47:35+00:00</updated>
<author>
<name>joboet</name>
<email>jonasboettiger@icloud.com</email>
</author>
<published>2024-06-15T15:47:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f3facf11758af878bcfaf47fc773962dbb565024'/>
<id>urn:sha1:f3facf11758af878bcfaf47fc773962dbb565024</id>
<content type='text'>
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
</content>
</entry>
</feed>
