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`
This commit is contained in:
commit
abfad21c97
1 changed files with 4 additions and 5 deletions
|
@ -14,12 +14,11 @@ pub macro thread_local_inner {
|
||||||
(@key $t:ty, const $init:expr) => {{
|
(@key $t:ty, const $init:expr) => {{
|
||||||
const __INIT: $t = $init;
|
const __INIT: $t = $init;
|
||||||
|
|
||||||
|
// NOTE: Please update the shadowing test in `tests/thread.rs` if these types are renamed.
|
||||||
unsafe {
|
unsafe {
|
||||||
use $crate::thread::LocalKey;
|
$crate::thread::LocalKey::new(|_| {
|
||||||
use $crate::thread::local_impl::EagerStorage;
|
static VAL: $crate::thread::local_impl::EagerStorage<$t> =
|
||||||
|
$crate::thread::local_impl::EagerStorage { value: __INIT };
|
||||||
LocalKey::new(|_| {
|
|
||||||
static VAL: EagerStorage<$t> = EagerStorage { value: __INIT };
|
|
||||||
&VAL.value
|
&VAL.value
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue