add `#[thread_local]` attribute

This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

After a snapshot, the existing thread local storage built on the POSIX
and Windows API can be replaced. This should be a significant increase
in performance.

Closes #10310