Skip to content

Commit

Permalink
Avoid use imports in thread_local_inner! in statik
Browse files Browse the repository at this point in the history
Fixes rust-lang#131863 for wasm targets

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

(cherry picked from commit 5368b12)
  • Loading branch information
youknowone authored and cuviper committed Nov 7, 2024
1 parent 12ed4c6 commit a160d9e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions library/std/src/sys/thread_local/statik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}
Expand Down

0 comments on commit a160d9e

Please sign in to comment.