about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-10-24 15:53:35 -0700
committerGitHub <noreply@github.com>2024-10-24 15:53:35 -0700
commitabfad21c973e30a3949916149ac4db5fe8691cf9 (patch)
tree9b599b3213fd66371edd8005c0932b6248db2188
parent3fea422be83f54f516eed5c2cd56d48621d2fc8d (diff)
parent5368b120a1742893460c515bb198342d6f0a3800 (diff)
downloadrust-abfad21c973e30a3949916149ac4db5fe8691cf9.tar.gz
rust-abfad21c973e30a3949916149ac4db5fe8691cf9.zip
Rollup merge of #132101 - youknowone:thread_local-gyneiene, r=tgross35
Avoid using imports in thread_local_inner! in static

Fixes #131863 for wasm targets

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

r? `@jieyouxu`
-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
             })
         }