diff --git a/.cargo/config.toml b/.cargo/config.toml index 0e465b2de..7a4169493 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,9 @@ [target.wasm32-unknown-unknown] rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] + +# Make `#[wasm_bindgen]` emit `js_sys::futures` glue instead of +# `wasm_bindgen_futures` for every cargo invocation in this workspace +# (check, clippy, build). The proc-macro reads this at expansion time, so it +# must be present for host builds too, not just the wasm build worker-build runs. +[env] +WASM_BINDGEN_USE_JS_SYS = "1" diff --git a/Cargo.lock b/Cargo.lock index e009d0e2f..6456dc037 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4050,7 +4050,6 @@ dependencies = [ "trybuild", "url", "wasm-bindgen", - "wasm-bindgen-futures", "wasm-bindgen-test", "wasm-streams", "web-sys", diff --git a/Cargo.toml b/Cargo.toml index 5ead2a238..e8429aba7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,6 @@ proc-macro2 = "1.0.60" quote = "1.0.28" wasm-bindgen = { version = "0.2.123" } wasm-bindgen-cli-support = { version = "0.2.123" } -wasm-bindgen-futures = { version = "0.4.73" } wasm-bindgen-macro-support = { version = "0.2.123" } wasm-bindgen-shared = { version = "0.2.123" } wasm-bindgen-test = { version = "0.3.73" } diff --git a/examples/axum/Cargo.toml b/examples/axum/Cargo.toml index 37de3cc00..388fefc53 100644 --- a/examples/axum/Cargo.toml +++ b/examples/axum/Cargo.toml @@ -15,6 +15,5 @@ worker-macros = { workspace = true, features = ['http'] } axum = { version = "0.8", default-features = false, features = ['json'] } axum-macros = "0.5.0" tower-service = "0.3.3" -wasm-bindgen-futures = { workspace = true } wasm-bindgen = { workspace = true } serde = { version = "1.0", features = ["derive"] } diff --git a/examples/tokio-postgres/src/lib.rs b/examples/tokio-postgres/src/lib.rs index 803562baf..4d0bc0fb9 100644 --- a/examples/tokio-postgres/src/lib.rs +++ b/examples/tokio-postgres/src/lib.rs @@ -15,7 +15,7 @@ async fn main(_req: Request, env: Env, _ctx: Context) -> anyhow::Result = Closure; /// server.accept()?; /// /// // Spawn a future for handling the stream of events from the websocket. -/// wasm_bindgen_futures::spawn_local(async move { +/// js_sys::futures::spawn_local(async move { /// let mut event_stream = server.events().expect("could not open stream"); /// /// while let Some(event) = event_stream.next().await {