Avoid use imports in thread_local_inner! in statik

Fixes #131863 for wasm targets

All other macros were done in #131866, but this sub module is missed.

(cherry picked from commit 5368b120a1)
This commit is contained in:
Jeong YunWon 2024-10-24 17:50:19 +09:00 committed by Josh Stone
parent 12ed4c6655
commit a160d9e36a

View File

@ -14,12 +14,11 @@ pub macro thread_local_inner {
(@key $t:ty, const $init:expr) => {{
const __INIT: $t = $init;
// NOTE: Please update the shadowing test in `tests/thread.rs` if these types are renamed.
unsafe {
use $crate::thread::LocalKey;
use $crate::thread::local_impl::EagerStorage;
LocalKey::new(|_| {
static VAL: EagerStorage<$t> = EagerStorage { value: __INIT };
$crate::thread::LocalKey::new(|_| {
static VAL: $crate::thread::local_impl::EagerStorage<$t> =
$crate::thread::local_impl::EagerStorage { value: __INIT };
&VAL.value
})
}