std::thread_local, std::thread::local, std::thread::local_impl, std::sys_common::thread_local_key, std::sys_common::thread_local_dtor, std::sys::thread_local_key, etc. etc. are all messy and form quite a confusing maze. Just look at this map I tried to draw of it all:

AAAaaaaAaa
Time to clean it up.
And maybe also fix some bugs while we're at it. ^^
Related issues to solve, maybe:
std::thread_local,std::thread::local,std::thread::local_impl,std::sys_common::thread_local_key,std::sys_common::thread_local_dtor,std::sys::thread_local_key, etc. etc. are all messy and form quite a confusing maze. Just look at this map I tried to draw of it all:AAAaaaaAaa
Time to clean it up.
And maybe also fix some bugs while we're at it. ^^
Keytype: Remove unused std::sys_common::thread_local_key::Key #110898extern "C"inthread_local::fast_local#112292Key, because most of those things are actually not keys, and dropLazyKeyInnerthread_local!{}expansion. Make TLS accessors closures that return pointers #125525*const Trather than&'static Twhen it's not really'static: Make TLS accessors closures that return pointers #125525#[thread_local])?ReentrantLock#124881thread::currentthread local more efficient and make it available in (most) TLS destructors: std: makethread::currentavailable in allthread_local!destructors #127912Related issues to solve, maybe:
Stack overflow in thread local's drop rendered as a segmentation fault. #109785