diff --git a/CHANGELOG.md b/CHANGELOG.md index 814fc96bf360..383a8090304f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,13 @@ * Add bindings for `WebAssembly.Tag` and `WebAssembly.Exception`. [#3484](https://github.com/rustwasm/wasm-bindgen/pull/3484) -* Re-export `wasm-bindgen` from `js-sys` and `web-sys`. +* Re-export `wasm-bindgen` from `js-sys`, `web-sys` and `wasm-bindgen-futures`. [#3466](https://github.com/rustwasm/wasm-bindgen/pull/3466) + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) -* Re-export `js-sys` from `web-sys`. +* Re-export `js-sys` from `web-sys` and `wasm-bindgen-futures`. [#3466](https://github.com/rustwasm/wasm-bindgen/pull/3466) + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) * Add bindings for async variants of `Atomics.wait`. [#3504](https://github.com/rustwasm/wasm-bindgen/pull/3504) @@ -93,6 +95,11 @@ * Fixed optional parameters in JSDoc. [#3577](https://github.com/rustwasm/wasm-bindgen/pull/3577) +* Use re-exported `js-sys` from `wasm-bindgen-futures` to account for + non-default path specified by the `crate` attribute in `wasm_bindgen_futures` + proc-macro. + [#3601](https://github.com/rustwasm/wasm-bindgen/pull/3601) + ### Removed * Removed `ReadableStreamByobReader::read_with_u8_array()` because it doesn't work with Wasm. diff --git a/crates/backend/src/codegen.rs b/crates/backend/src/codegen.rs index 4e3d6ca8d9a8..e45d4e50ba19 100644 --- a/crates/backend/src/codegen.rs +++ b/crates/backend/src/codegen.rs @@ -1190,11 +1190,11 @@ impl TryToTokens for ast::ImportFunction { Some(ref ty) => { if self.function.r#async { abi_ret = quote! { - #wasm_bindgen::convert::WasmRet<::Abi> + #wasm_bindgen::convert::WasmRet<<#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - + <#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ret_ident.join()) ).await }; @@ -1216,11 +1216,11 @@ impl TryToTokens for ast::ImportFunction { None => { if self.function.r#async { abi_ret = quote! { - #wasm_bindgen::convert::WasmRet<::Abi> + #wasm_bindgen::convert::WasmRet<<#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi>::Abi> }; let future = quote! { #wasm_bindgen_futures::JsFuture::from( - + <#wasm_bindgen_futures::js_sys::Promise as #wasm_bindgen::convert::FromWasmAbi> ::from_abi(#ret_ident.join()) ).await }; diff --git a/crates/futures/src/lib.rs b/crates/futures/src/lib.rs index c2a59d76286c..8a02a51bc393 100644 --- a/crates/futures/src/lib.rs +++ b/crates/futures/src/lib.rs @@ -46,6 +46,9 @@ mod queue; #[cfg(feature = "futures-core-03-stream")] pub mod stream; +pub use js_sys; +pub use wasm_bindgen; + mod task { use cfg_if::cfg_if; diff --git a/crates/macro/ui-tests/async-errors.stderr b/crates/macro/ui-tests/async-errors.stderr index 188192c5d87a..a128c73c0904 100644 --- a/crates/macro/ui-tests/async-errors.stderr +++ b/crates/macro/ui-tests/async-errors.stderr @@ -32,10 +32,10 @@ error[E0277]: the trait bound `wasm_bindgen::JsValue: From` is not sati > > > - > - > - >> - and 74 others + > + > + > + and $N others = note: required for `BadType` to implement `Into` = note: required for `BadType` to implement `IntoJsResult` = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)