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.
  • Loading branch information
youknowone committed Oct 24, 2024
1 parent 8baae66 commit d25ee97
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions 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 d25ee97

Please sign in to comment.