rust/library/std/src/sys/thread_local
bors 27529d5c25 Auto merge of #125525 - joboet:tls_accessor, r=cuviper
Make TLS accessors closures that return pointers

The current TLS macros generate a function that returns an `Option<&'static T>`. This is both risky as we lie about lifetimes, and necessitates that those functions are `unsafe`. By returning a `*const T` instead, the accessor function do not have safety requirements any longer and can be made closures without hassle. This PR does exactly that!

For native TLS, the closure approach makes it trivial to select the right accessor function at compile-time, which could result in a slight speed-up (I have the hope that the accessors are now simple enough for the MIR-inliner to kick in).
2024-06-04 05:03:52 +00:00
..
fast_local Auto merge of #125525 - joboet:tls_accessor, r=cuviper 2024-06-04 05:03:52 +00:00
mod.rs std: clean up the TLS implementation 2024-05-24 12:28:05 +02:00
os_local.rs std: make TLS accessors closures that return pointers 2024-05-25 00:19:47 +02:00
static_local.rs std: make TLS accessors closures that return pointers 2024-05-25 00:19:47 +02:00