-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify TLS destructor list implementations #116850
Conversation
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
The Miri subtree was changed cc @rust-lang/miri |
☔ The latest upstream changes (presumably #116402) made this pull request unmergeable. Please resolve the merge conflicts. |
9e13c63
to
abd6645
Compare
☔ The latest upstream changes (presumably #118126) made this pull request unmergeable. Please resolve the merge conflicts. |
abd6645
to
232a3c4
Compare
☔ The latest upstream changes (presumably #117873) made this pull request unmergeable. Please resolve the merge conflicts. |
232a3c4
to
4708bb2
Compare
☔ The latest upstream changes (presumably #117285) made this pull request unmergeable. Please resolve the merge conflicts. |
4708bb2
to
79f310a
Compare
☔ The latest upstream changes (presumably #120486) made this pull request unmergeable. Please resolve the merge conflicts. |
Now that the fallback code has been removed, there are no users of `StaticKey` left for targets with native TLS. Therefore, move the at-exit hack to the thread-local guard module, where it can be shared by both implementations, and cfg-out the key-based TLS when it's not needed.
79f310a
to
5e1727c
Compare
☔ The latest upstream changes (presumably #121569) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing in favour of #126523. |
Part of #110897.
Currently, nearly every platform implements its own TLS destructor list. This adds unnecessary code and means that issues like #116390 are harder to find and fix. Therefore, this PR unifies all of these implementations into a shared one inside
sys::common::fast_local
, leaving behind only the platform calls needed to ensure the list is emptied.This changes behaviour on some Linux-like platforms, because we now keep our own list. This should however not impact performance too much, as the platform calls would also have needed to allocate.
Because it is only used on UNIX and is now much easier, I've removed the fallback implementation in
sys_common
. BecauseStaticKey
may now be unused, this resulted in errors for Windows, which is why I have refactored that code to move the at-exit hack to the newthread_local_guard
module. If it causes too much review pain, I can split this part out.Tested on aarch64 macOS, checked on all other platforms. Best reviewed per-commit.
@rustbot label +T-libs +A-thread-locals