Added
-
Added
OffscreenCanvasoverloads for the WebGLtexImage2D,texSubImage2D,texImage3DandtexSubImage3Dfunctions, matching theTexImageSourcetypedef in the WebGL specification. #5312 -
Added
--split-debug-infoto the CLI. This option extracts the DWARF debug info to a separate*_bg.debug.wasmfile. Use--debug-info-urlto set the recorded URL for the debug info. #5279 -
Added
#[wasm_bindgen(experimental_generic_mono)]for imported functions, which binds a generic import once per monomorphisation instead of erasing its type parameters toJsValue. It can be applied to an individual import or to a wholeextern "C"block, which every generic function in the block then inherits. Each instantiation gets its own descriptor, so arguments and return values are marshalled at their concrete types (au32crosses as a number, aStringas a string) rather than being boxed. Trait bounds,wherepredicates (including higher-ranked ones), associated-type projections, lifetime parameters, argument-positionimpl Trait, raw callbacks with owned generic inputs and returns,async,catch, andslice_to_arrayare all supported; see the guide for the supported surface and the shapes that are rejected. The attribute is experimental and may change as it stabilizes. #5230 #5272 #5314 -
#[wasm_bindgen(experimental_generic_mono)]now supports class-level generic parameters: an imported type that is itself generic (type Holder<T>), used as a method receiver (this: &Holder<T>), or as the return type of a constructor or self-returning static method (fn new<T>(value: T) -> Holder<T>). See Class-level generics in the guide. #5290 -
A generic imported type used as a method receiver or a constructor's return type may now carry concrete generic arguments (
this: &Holder<u32>,this: &Holder<u32, T>). The arguments are re-emitted as written, so the generated method hangs offimpl Holder<u32>rather than the class's own parameter defaults. #5290 -
Added experimental JSPI (JS Promise Integration) support: using it emits a compiler warning noting the experimental status. Supports
#[wasm_bindgen(jspi)]on exports (sync orasync), within which a#[wasm_bindgen(suspending)]import call can suspend to the JS event loop until itsPromisesettles.js_sys::futures::jspi_block_on_promisealso suspends on anyPromiseinside a synchronous function, whilespawn_localis context-aware: tasks spawned from within a JSPI context support synchronous JSPI suspensions throughout their call trees. Compatible withcatch(rejections asErr),async, andpanic=unwind. #5193 -
Added a
--ts-typed-array-buffersCLI flag to declare owned typed-array return values (e.g.Vec<u8>) asUint8Array<ArrayBuffer>in generated TypeScript, since they are always copied into a fresh, non-sharedArrayBuffer. Requires TypeScript 5.7+. #5263
Changed
-
Export shim symbols are now mangled with a per-crate hash, so identically named exports from different crates (or two versions of one crate) no longer fail the link with duplicate-symbol errors; the CLI restores the canonical names in the final module. Same-named
#[wasm_bindgen(private)]structs/enums now coexist (numberedName,Name2, ... internally in the generated bindings), while genuinely conflicting public exports are reported as a wasm-bindgen error instead of a wasm-ld failure. Requires matchingwasm-bindgenand CLI versions (schema bump). #2247 -
Setting
js_namespaceon both anextern "C"block and an item inside it is now a hard error. Nested paths must be written in a single attribute, e.g.js_namespace = ["a", "b"]. The previous behavior silently dropped the block-level namespace. #4324 -
Changed WebGPU
setImmediatesAPIs to take immutable u8 slice. #5289 -
Changed Web Bluetooth
writeValue/writeValueWithResponse/writeValueWithoutResponseand WebUSBcontrolTransferOut/transferOut/isochronousTransferOutAPIs to take immutable u8 slices. #5309 -
Emscripten glue no longer reads
wasmExports['name']inline inside inner functions. It now references the asmjs-mangled identifiers emcc's own top-levelassignWasmExportsreceiving code binds for every wasm export (e.g.___wbindgen_malloc,___wbindgen_externrefs), which are the canonical DCE-graph pairs: wasm-metadce keeps exactly the exports the included glue uses (previously internal exports and the externref table could be stripped or left unrenamed by the import/export minifier at-O2, breaking at runtime). Hoisted classes are now emitted as=-prefixed string value snippets so jsifier declares them asexport var Class = class Class {...}instead of anexport classdeclaration, which crashes emcc's acorn-optimizer under-sMODULARIZE=instance.
Fixed
-
The thread-bootstrap transform is now skipped in Emscripten mode, where the Emscripten runtime owns pthread startup and TLS. It previously ran on any module with shared memory and aborted the build (
failed to find __wasm_init_tls), since Emscripten's linker had already consumed the synthetic symbols it looks for. #5315 -
Fixed conflicting deprecation messages on
web-sysdictionary fields that are themselves deprecated: the deprecated builder-style method no longer points at an equally-deprecated setter, and the WebAuthn fields removed from the specification (such asPublicKeyCredentialRpEntity'sicon) now state why they are deprecated. #5302 -
#[wasm_bindgen]on a struct now reports an actionable error when the path to thewasm_bindgencrate cannot be resolved (e.g. whenwasm-bindgenis only a transitive dependency throughweb-sys), instead of a confusing recursion limit error. #5295 -
Fixed
js_namespaceexports missing from the bundler target's entry module re-export list, making namespaces unreachable when importing the package. #5267 -
The CLI now reports an actionable error when the
__wasm_bindgen_unstablecustom section is missing from a module that still contains wasm-bindgen shims (e.g. stripped byllvm-objcopy --strip-all, which removes all custom sections since LLVM 23), instead of the confusingimport of `X` doesn't have an adapter listed. #5268 -
The generated
&Thandle conversions (IntoWasmAbi/OptionIntoWasmAbi) for an imported type with lifetime parameters (type Holder<'a, T>) no longer reuse'afor the reference itself. Previously the impl header declared only a fresh'aplus the type's type parameters, so a type whose lifetime was not literally named'afailed withE0261against generated code, and one that was named'ahad its lifetime forced to unify with the borrow of&self— surfacing asE0521whenever a generic method also had to resolve through the same impl. #5290 -
An inline lifetime bound on a generic import (
fn f<'a: 'b, 'b, T>(..)) is no longer dropped from the generated wrapper. Previously the bound was lost while the generated shim still declared it, so calling the import failed with "lifetime may not live long enough" reported against generated code. #5290 -
A type-parameter default on a
#[wasm_bindgen(experimental_generic_mono)]import is no longer silently ignored. It has no meaning there (every instantiation gets its own shim, so there is no single one to default) and rustc's owninvalid_type_param_defaultlint cannot see it, since nothing of the original signature survives expansion; it is now rejected with the samedefaults for generic parameters are not allowed herediagnostic rustc gives. Defaults on the type-erasure generic path are unaffected, where they remain meaningful. #5290 -
Fix
js-syswasm64 build withatomicsfeature. #5274 -
Declare
initSyncin the generated TypeScript definitions for--target no-modules, matching thewasm_bindgen.initSyncfunction that the JS output already exposes. #5284 -
Removed the last panicking code paths from
externreftable management:RefCell::borrow_mut()embedded panic location data (including the source path string) in.rodataof optimized builds, which not evenwasm-optcould remove. #5292 -
Fix
--no-modules-globalbeing ignored: the custom global name is now used for the generated JS binding and TypeScript declarations, and the name is validated as a JS identifier. #5286