Skip to content

Commit

Permalink
Unrolled build for rust-lang#132101
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#132101 - youknowone:thread_local-gyneiene, r=tgross35

Avoid using imports in thread_local_inner! in static

Fixes rust-lang#131863 for wasm targets

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

r? `@jieyouxu`
  • Loading branch information
rust-timer authored Oct 25, 2024
2 parents 3dc1b9f + 5368b12 commit 3b6f548
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 3b6f548

Please sign in to comment.