Skip to content

Commit

Permalink
Fix macro-hygiene for calls to std::thread_local! (#4315)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Dec 4, 2024
1 parent 0d1ae06 commit 89f8a42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* Add clear error message to communicate new feature resolver version requirements.
[#4312](https://github.com/rustwasm/wasm-bindgen/pull/4312)

### Fixed

* Fix macro-hygiene for calls to `std::thread_local!`.
[#4315](https://github.com/rustwasm/wasm-bindgen/pull/4315)

--------------------------------------------------------------------------------

## [0.2.97](https://github.com/rustwasm/wasm-bindgen/compare/0.2.96...0.2.97)
Expand Down
6 changes: 3 additions & 3 deletions crates/backend/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ impl ToTokens for ast::ImportStatic {
fn init() -> #ty {
#init
}
thread_local!(static _VAL: #ty = init(););
#wasm_bindgen::__rt::std::thread_local!(static _VAL: #ty = init(););
#wasm_bindgen::JsStatic {
__inner: &_VAL,
}
Expand Down Expand Up @@ -1763,7 +1763,7 @@ fn thread_local_import(

match thread_local {
ast::ThreadLocal::V1 => quote! {
thread_local! {
#wasm_bindgen::__rt::std::thread_local! {
#[automatically_derived]
#[deprecated = "use with `#[wasm_bindgen(thread_local_v2)]` instead"]
#vis static #name: #actual_ty = {
Expand All @@ -1774,7 +1774,7 @@ fn thread_local_import(
ast::ThreadLocal::V2 => {
#[cfg(feature = "std")]
let inner = quote! {
thread_local!(static _VAL: #actual_ty = init(););
#wasm_bindgen::__rt::std::thread_local!(static _VAL: #actual_ty = init(););
#wasm_bindgen::JsThreadLocal {
__inner: &_VAL,
}
Expand Down
3 changes: 0 additions & 3 deletions src/convert/slices.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#[cfg(feature = "std")]
use std::prelude::v1::*;

use alloc::boxed::Box;
use alloc::string::String;
use alloc::vec::Vec;
Expand Down

0 comments on commit 89f8a42

Please sign in to comment.