Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information