about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeong YunWon <jeong@youknowone.org>2024-10-24 17:50:19 +0900
committerJeong YunWon <jeong@youknowone.org>2024-10-25 05:44:42 +0900
commit5368b120a1742893460c515bb198342d6f0a3800 (patch)
tree8967e818eecef937ca213df5653edb5fa45c0295
parent1d4a7670d4f37bfbae2d89ec3ec07cd40dbc5a5d (diff)
downloadrust-5368b120a1742893460c515bb198342d6f0a3800.tar.gz
rust-5368b120a1742893460c515bb198342d6f0a3800.zip
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.
-rw-r--r--library/std/src/sys/thread_local/statik.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/library/std/src/sys/thread_local/statik.rs b/library/std/src/sys/thread_local/statik.rs
index ba94caa6690..4da01a84acf 100644
--- a/library/std/src/sys/thread_local/statik.rs
+++ b/library/std/src/sys/thread_local/statik.rs
@@ -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
             })
         }