chore(deps): update rust crate wasm-bindgen to v0.2.126#2249
Open
renovate[bot] wants to merge 1 commit into
Open
chore(deps): update rust crate wasm-bindgen to v0.2.126#2249renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
d8f6751 to
99c69ea
Compare
99c69ea to
596bd8c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
=0.2.114→=0.2.126Release Notes
wasm-bindgen/wasm-bindgen (wasm-bindgen)
v0.2.126Compare Source
Changed
enums, plus their finalization registries and string-enum tables) out of the
$initBindgeninit closure into its own top-leveladdToLibrarysymbol andself-registers it into
EXPORTED_FUNCTIONS. emscripten then emits the cleanAPI (
add,Counter, ...) as named ESM exports under-sMODULARIZE=instanceand as
Module.<name>properties (via each symbol's__postset) in factorymode, with no extra sidecar files. Namespaced exports are reached through
their namespace root (e.g.
app), assembled in the root symbol's__postset.User module/inline-js imports are now wired as
addToLibraryshims (they werepreviously dropped, since emcc resolves imports only against
env), and theirESM-imported bindings are
__wbg_-prefixed to avoid colliding with emccruntime names such as
Module/HEAP8.#5210
Fixed
The descriptor interpreter now follows emscripten
invoke_*trampolines.emscripten's exception/longjmp lowering rewrites direct calls into indirect
calls through the function table wrapped in imported
invoke_*(fnptr, ..args)helpers, including the describe helpers a descriptor function must reach. The
interpreter resolves
fnptragainst the reconstructed function table, forwardsthe trailing arguments, and evaluates the surrounding "did it throw?" control
flow (
if/else,loop,br_table), so descriptors are interpretedcorrectly on emscripten builds with unwinding/longjmp enabled.
#5215
Relaxed alignment requirement for 8-byte types.
#5204
Removed
v0.2.125Compare Source
Added
--force-enable-abort-handlerCLI flag, which emits the hard-abortdetection and
set_on_abortmachinery onpanic=abortbuilds. Withpanic=unwindthis machinery is generated automatically; the flag doesnothing there.
#5191
Changed
__wbindgen_destroy_closureexport private in the Rust API.#5196
v0.2.123Compare Source
Added
Added the
maxAgeattribute to theCookieInitdictionary inweb-sys,matching the current Cookie Store API specification.
#5169
The js-sys futures codegen opt-in can now also be enabled via the
WASM_BINDGEN_USE_JS_SYS=1environment variable, in addition to--cfg=wasm_bindgen_use_js_sys. This works on stable when--targetis in use, where Cargo does not propagate the cfg to host proc-macros.
#5164
Changed
JsOption<T>now treats onlyundefinedas empty, aligning it withTypeScript's strict
T | undefinedsemantics and withOption<T>'s wireshape (
None↔undefined). Previouslyis_empty,as_option,into_option,unwrap,expect,unwrap_or_default, andunwrap_or_elsetreated bothnullandundefinedas absent; JSnullis now a distinct present value. The
impl<T> UpcastFrom<Null> for JsOption<T>is removed (Undefinedstill models absence), and theDebug/Displayabsent placeholder changed from"null"to"undefined". Code relying onnull → Noneshould returnundefinedfrom the JS side, or check explicitly with
val.as_option().filter(|v| !v.is_null()).#5170
Fixed
Removed invalid
js_sys::Array<T>tojs_sys::ArrayTuple<(...)>upcasts.ArrayTupleencodes a fixed tuple arity, while a plain JavaScript array doesnot prove that arity statically.
Fixed incorrect variance in
&mutreference upcasting.&mut Tupcastswere covariant in the pointee, so a
&mut Tcould be widened to a&mutof a supertype and used to write back a value the original type would not
accept, leaving a reference whose static type no longer matches the value
it points to. Mutable references are now invariant in their pointee:
&mut Tonly upcasts to&mut Targetwhen bothTarget: UpcastFrom<T>and
T: UpcastFrom<Target>hold. This rejects the invalid widening but isa breaking change for callers that relied on widening
&mutreferences.#5176
Fixed WASI targets (
wasm32-wasip1/wasm32-wasip2) emitting unresolved__wbindgen_placeholder__imports, which broke component linking. Thecodegen and runtime gates now exclude
target_os = "wasi"(restoring thepre-0.2.115 stub behavior), including the
panic = "unwind"paths inwasm-bindgen-futures.#5175
Fixed a panic ("Unhandled load width 8") in the descriptor interpreter when
processing
-Cinstrument-coverage-instrumented modules, unblockingcargo llvm-cov --target wasm32-unknown-unknownfor crates whose describehelpers get instrumented.
#5179
Fixed
mainsilently never running on wasm64 for bin crates.#5181
v0.2.122Compare Source
Notices
Threading support now requires
-Clink-arg=--export=__heap_baseto be setin
RUSTFLAGSfor nightly toolchains from 2026-05-06 onward, afterrust-lang/rust#156174
removed the implicit
__heap_base/__data_endexports onwasm*targets. Atomics CI, CLI reference tests, and the
nodejs-threads,raytrace-parallel, andwasm-audio-workletexamples have beenupdated to pass
--export=__heap_baseexplicitly. The flag isbackward-compatible with older nightlies.
-Cpanic=unwindon wasm targets now emits modern (exnref) exceptionhandling by default after
rust-lang/rust#156061,
and requires Node.js 22.22.3+ (for
WebAssembly.JSTag). Legacy EH wasmcan still be produced on current nightlies by adding
-Cllvm-args=-wasm-use-legacy-ehtoRUSTFLAGS; Node.js 20 may besupported with legacy exception handling, with a tracking issue in
#5151.
Added
Implemented
TryFromJsValueforVec<T>whereT: TryFromJsValue.A JS value converts when it is a real
Array(perArray.isArray)and every element converts via
T::try_from_js_value. This composesrecursively (
Vec<Vec<String>>,Vec<Option<T>>) and works for anyTwith aTryFromJsValueimpl, including primitives,String,JsValue, andJsCasttypes. Array-likes (objects withlengthandnumeric indices) are intentionally rejected to mirror the static ABI
representation used by
js_value_vector_from_abi.New
extends_js_classandextends_js_namespaceattributes onexported structs to allow defining the parent
js_classname whenit has been customized by
js_nameand the parent's ownjs_namespaceas well in turn. New validation is added at code generation time that
will now catch these cases instead of emitting invalid code. Example:
#5154
Changed
When an exported struct uses
js_namespace, the corresponding valuemust now be repeated on every
implblock. Previously the impl-sidedefaults silently worked resulting in inconsistent emission. Example:
To ease this transition for
js_namespaceusage, diagnosticmessages now include hints for missing namespaces for easier
fixing.
#5154
Fixed
Fixed the descriptor interpreter panicking on
BrandBrIfinstructions emitted by recent nightly compilers when building with
panic=unwind.#5158
Emscripten output now works against vanilla upstream emscripten without
requiring a fork. Dependency tracking,
HEAP_DATA_VIEWsetup,function-decl intrinsic inlining, catch-wrapper gating, and imported
global handling have all been corrected; ESM imports
(
#[wasm_bindgen(module = "...")]and snippets) are emitted to asidecar
library_bindgen.extern-pre.jsconsumers pass to emcc via--extern-pre-js; namespaced exports (js_namespace = [...]on astruct/impl) now attach to
Module.<segments>instead of emittingtop-level
export const(which emcc's library evaluator rejects);the generated
.d.tsfor namespaced exports is now valid TypeScript(mangled identifiers stay module-internal via
declare class/declare enum/declare functionplusexport { BindgenModule };to mark the file as a module; no spurious unqualified
Calc:property on
BindgenModulefor namespaced items; namespace shapesland as plain interface members (
app: { math: { Calc: typeof app__math__Calc } };) instead of the previously-emittedexport let app: { ... };which was invalid TS1131 syntax inside aninterface body).
#5156
Fixed a duplicate phantom class being emitted for an exported struct
renamed via
js_name(Rust ident != JS class name) and/or placed in ajs_namespace, when the struct crosses the boundary as aJsValue(e.g. via
.into()). TheWrapInExportedClass/UnwrapExportedClassimports were keyed by the Rust ident rather than the qualified JS name
that
exported_classesis keyed by (a regression from #5154), so afresh empty class entry was minted and emitted alongside the real one,
with a
free()referencing a nonexistent wasm export. Riding thesame release's #5154 wire-format bump, the now-vestigial
rust_namefield is dropped from the schema and the namespace-qualified name is
no longer cached on
AuxStruct,AuxEnum, orExportedClass(derived on demand from
(name, js_namespace)), collapsing threefallback chains that only papered over the pre-#5154 keying.
#5160
v0.2.121Compare Source
Added
Added the
slice_to_arrayattribute for imported JS functions,which makes a
&[T](orOption<&[T]>) argument arrive on the JSside as a plain
Arrayrather than a typed array — withoutchanging the Rust-side
&[T]signature. Useful when binding JSAPIs that take
T[]rather thanTypedArray<T>. For primitiveelement kinds the wire is the same zero-copy borrow used by plain
&[T], with the JS-side shim wrapping the view inArray.from(...)to materialise the
Array— no extra allocation. ForString,JsValue, and JS-imported element types the Rust side builds afresh
[u32]index buffer that JS reads and frees, with per-element&T -> JsValue(refcount bump for handle-shaped types). NoT: Clonebound is required. The attribute can be set per-fn(
#[wasm_bindgen(slice_to_array)] fn ...) or per-block on anextern "C" { ... }declaration to apply to every imported functionin that block.
&[ExportedRustStruct]remains unsupported (useowned
Vec<T>for that). Has no effect on exported functions;default
&[T](typed-array view / memory borrow) and ownedVec<T>semantics are unchanged for callers that didn't opt in.See the
slice_to_arrayguide page.#5145
Added
js_sys::AggregateErrorbindings (constructor,errorsgetter, andnew_with_message/new_with_optionsoverloads).AggregateErrorrepresentsmultiple unrelated errors wrapped in a single error, e.g. as thrown by
Promise.anywhen all input promises reject, along withjs_sys::ErrorOptions,accepted by built-in error constructors.
ErrorOptions::new(cause)constructs an instance pre-populated with
cause, andget_cause/set_causeprovide typed access to the property. All standard errorconstructors that previously took only a
message(EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,WebAssembly.CompileError,WebAssembly.LinkError,WebAssembly.RuntimeError) now expose anew_with_options(message, &ErrorOptions)overload, andErrorgainsnew_with_error_options(message, &ErrorOptions)alongside the existinguntyped
new_with_options.AggregateError::new_with_optionsalso takes&ErrorOptions.#5139
Added inheritance for Rust-exported types: an exported struct may
declare
#[wasm_bindgen(extends = Parent)]to inherit from anotherexported
#[wasm_bindgen]struct. The macro injects a hiddenparent: wasm_bindgen::Parent<Parent>field (a refcounted cell aroundthe parent value) and emits
class Child extends Parentin thegenerated JS /
.d.ts. The child gets anAsRef<Parent<Parent>>implfor the direct parent, and threads per-class pointer slots through
the wasm ABI so that
instanceof Parentis true and parent methodsdispatch soundly via the JS prototype chain. From inside child
methods, parent data is reached via
self.parent.borrow()/self.parent.borrow_mut(). See the newextendsguide page.#5120
Added
js_sys::FinalizationRegistrybindings (constructor,register,register_with_token, andunregister). The cleanup callback parameteris typed as
&Function<fn(JsValue) -> Undefined>, so closures created viaClosure::newcan be passed usingFunction::from_closure(for ownedclosures retained by JS) or
Function::closure_ref(for borrowed scopedclosures). Pairs with the existing
js_sys::WeakRefbindings.#5140
Added support for well-known symbols in
js_name,getter, andsettervia the explicit bracket-string form"[Symbol.<name>]". This works for imported and exported methods,fields, getters, and setters. For example,
#[wasm_bindgen(js_name = "[Symbol.iterator]")]on an exported methodgenerates
[Symbol.iterator]() { ... }on the generated JS class, andthe same syntax works for
getter/setterand for imported items.#4230
Added level 2 bindings for
ViewTransitiontoweb-sys.#5138
Add support for dynamic unions: a
#[wasm_bindgen]enum that mixes string-literalvariants with single-field tuple variants is now exported as an untagged TypeScript
union and dispatched dynamically at the JS↔Rust boundary. The new enum-level
#[wasm_bindgen(fallback)]attribute makes the last tuple variant anunconditional catch-all, supporting unions whose trailing variant has no
runtime check (e.g., interface-only imports). String enums and dynamic
unions now emit
export type(was baretype) so the alias is a namedexport, and both honour the
privateflag to suppress the keyword.#4734
#2153
#2088
Fixed
From<Promise<T>> for JsFuture<T>andIntoFuture for Promise<T>nowaccept any
T: FromWasmAbi(rather thanT: JsGeneric), lettingimported
async fns return dynamic-union enums.TryFromJsValuefor C-style enums no longer accepts non-numeric valuesvia JS unary
+coercion. Previously callingdyn_into::<MyEnum>()ona string would silently coerce it via
+"foo"(yieldingNaN, thenNaN as u32 = 0) and could match a discriminant by accident; theconversion now returns
Nonefor any value that is not a JS number.#4734
Fix compilation failure with
no_std+release#5134
Raw identifiers (
r#name) on enums, enum variants, extern types, statics,and
implblocks no longer leak ther#prefix into generated JS / TSoutput and shim names. The Rust-side identifier and the JS-side name are
now tracked separately for enum variants, and all known identifier
fallback paths apply
Ident::unraw()so e.g.pub enum r#Enum { r#A }generatesEnum.Ainstead of producingsyntactically invalid JS.
#4323
Using the
-C panic=unwindoption when building for the bundler targetwould produce invalid JS.
#5142
Changed
js_sys::DataViewnow implements thejs_sys::TypedArraytrait. AFIXMEnotes that the trait should be renamed toArrayBufferViewinthe next major release to better reflect the WebIDL spec name covering
both
DataViewand the typed-array types.#5135
v0.2.120Compare Source
v0.2.118Compare Source
Added
Added
Error::stack_trace_limit()andError::set_stack_trace_limit()bindingsto
js-sysfor the non-standard V8Error.stackTraceLimitproperty.#5082
Added support for multiple
#[wasm_bindgen(start)]functions, which arechained together at initialization, as well as a new
#[wasm_bindgen(start, private)]to register a start function withoutexporting it as a public export.
#5081
Reinitialization is no longer automatically applied when using
panic=unwindand
--experimental-reset-state-function, instead it is triggered by anyuse of the
handler::schedule_reinit()function underpanic=unwind,which is supported from within the
on_aborthandler for reinit workflows.Renamed
handler::reinit()tohandler::schedule_reinit()and removedthe
set_on_reinit()handler. The__instance_terminatedaddressis now always a simple boolean (
0= live,1= terminated).#5083
handler::schedule_reinit()now works underpanic=abortbuilds. Previouslyit was a no-op; it now sets the JS-side reinit flag and the next export call
transparently creates a fresh
WebAssembly.Instance.#5099
Changed
#5102
Fixed
ES module
importstatements are now hoisted to the top of generated JSfiles, placed right after the
@ts-self-typesdirective. This ensuresvalid ES module output since
importdeclarations must precede otherstatements.
#5103
Fixed two CLI issues affecting WASM modules built by rustc 1.94+. First,
a panic (
failed to find N in function table) caused by lld emitting elementsegment offsets as
global.get $__table_baseor extended const expressionsinstead of plain
i32.const Nfor large function tables; the fix adds aconst-expression evaluator in
get_function_table_entryand guards againstinteger underflow in multi-segment tables. Second, the descriptor interpreter
now routes all global reads/writes through a single
globalsHashMap seededfrom the module's own globals, and mirrors the module's actual linear memory
rather than a fixed 32KB buffer, so the stack pointer's real value is valid
without any override. This fixes panics like
failed to find 32752 in function tablecaused byGOT.func.internal.*globals being misidentified as thestack pointer.
#5076
#5080
#5093
#5095
v0.2.117Compare Source
Fixed
Fixed a regression introduced in #5026 where stable
web-sysmethods thataccept a union type containing a
[WbgGeneric]interface (e.g.ImageBitmapSource, which includesVideoFrame) incorrectly applied typedgenerics to all union expansions rather than only those whose argument type
is itself
[WbgGeneric]. In practice this causedWindow::create_image_bitmap_with_*and the corresponding
WorkerGlobalScopeoverloads to returnPromise<ImageBitmap>instead ofPromise<JsValue>for the stable(non-
VideoFrame) call sites, breakingJsFuture::from(promise).await?.#5064
#5073
Fixed handling logic for environment variable
WASM_BINDGEN_TEST_ADDRESSinthe test runner, when running tests in headless mode.
#5087
v0.2.116Compare Source
Added
js_sys::Float16Arraybindings,DataViewfloat16 accessors usingf32, and raw[u16]helper APIs for interoperability with binary16representations such as
half::f16.#5033
Changed
Updated to Walrus 0.26.1 for deterministic type section ordering.
#5069
The
#[wasm_bindgen]macro now emits&mut (impl FnMut(...) + MaybeUnwindSafe)/
&(impl Fn(...) + MaybeUnwindSafe)for raw&mut dyn FnMut/&dyn Fnimport arguments instead of a hidden generic parameter and where-clause. The
generated signature is cleaner and the
MaybeUnwindSafebound is visibledirectly in the argument position. The ABI and wire format are unchanged.
When building with
panic=unwind, closures that capture non-UnwindSafevalues (e.g.
&mut T,Cell<T>) must wrap them inAssertUnwindSafebeforecapture; on all other targets
MaybeUnwindSafeis a no-op blanket impl.#5056
v0.2.115Compare Source
Added
console.debug/log/info/warn/erroroutput from user-spawnedWorkerandSharedWorkerinstances is now forwarded to the CLI test runner duringheadless browser tests, just like output from the main thread. Works for
blob URL workers, module workers, URL-based workers (importScripts), nested
workers, and shared workers (including logs emitted before the first port
connection). Non-cloneable arguments are serialized via
String()ratherthan crashing the worker. The
--nocaptureflag is respected.#5037
js_sys::Promise<T>now implementsIntoFuture, enabling direct.awaitonany JS promise without a wrapper type. The
wasm-bindgen-futuresimplementationhas been moved into
js-sysbehind an optionalfuturesfeature, which isactivated automatically when
wasm-bindgen-futuresis a dependency. Allexisting
wasm_bindgen_futures::*import paths continue to work unchanged viare-exports.
js_sys::futuresis also available directly for users who wantpromise.awaitwithout depending onwasm-bindgen-futures.#5049
Added
--target emscriptensupport, generating alibrary_bindgen.jsfilefor consumption by Emscripten at link time. Includes support for futures,
JS closures, and TypeScript output. A new Emscripten-specific test runner is
also included, along with CI integration.
#4443
Added
VideoFrame,VideoColorSpace, and related WebCodecs dictionaries/enums toweb-sys.#5008
Added
wasm_bindgen::handlermodule withset_on_abortandset_on_reinithooks for
panic=unwindbuilds.set_on_abortregisters a callback invokedafter the instance is terminated (hard abort, OOM, stack overflow).
set_on_reinitregisters a callback invoked afterreinit()resets theWebAssembly instance via
--experimental-reset-state-function. Handlers arestored as Wasm indirect-function-table indices so dispatch is safe even when
linear memory is corrupt.
Changed
Replaced per-closure generic destructors with a single
__wbindgen_destroy_closureexport.
#5019
Refactored the headless browser test runner logging pipeline for dramatically improved
performance (>400x faster on Chrome, >10x on Firefox, ~5x on Safari). Switched to
incremental DOM scraping with
textContent.slice(offset), append-only output semantics,unified log capture across all log levels on failure, and browser-specific invisible-div
optimizations (
display:nonefor Chrome/Firefox,visibility:hiddenfor Safari).#4960
TTY-gated status/clear output in the test runner shell to avoid
\rcontrol-characterartifacts in non-interactive (CI) environments.
#4960
Added
bench_console_log_10mbbenchmark alongside the existing 1MB benchmark for theheadless test runner. The main branch cannot complete this benchmark at any volume.
#4960
Updated to Walrus 0.26
#5057
Fixed
Fixed argument order when calling multi-parameter functions in the
wasm-bindgeninterpreter by reversing the args collected from the stack.#5047
Added support for per-operation
[WbgGeneric]in WebIDL, restoring typedgeneric return types (e.g.
Promise<ImageBitmap>) forcreateImageBitmaponWindowandWorkerGlobalScopethat were lost after theVideoFramestabilization.
#5026
Fixed missing
#[cfg(feature = "...")]gates on deprecated dictionary buildermethods and getters for union-typed fields (e.g.
{Open,Save,Directory}FilePickerOptions::start_in()),and fixed per-setter doc requirements to list each setter's own required features.
#5039
Fixed
JsOption::new()to useundefinedinstead ofnull, to be compatible withOption::Noneand JS default parameters.#5023
Fixed unsound
unsafetransmutes inJsOption<T>::wrap,as_option, andinto_optionby replacing
transmute_copywithunchecked_into(). Also tightened theJsGenerictrait bound and
JsOption<T>impl block to requireT: JsGeneric(which impliesJsCast),preventing use with arbitrary non-JS types.
#5030
Fixed headless test runner emitting
\rcarriage-return sequences in non-TTY environments,which polluted captured logs in CI and complicated output-matching tests.
#4960
Fixed headless test runner printing incomplete and out-of-order log output on test failures
by merging all five log levels into a single unified output div.
#4960
Fixed large test outputs (10MB+) causing oversized WebDriver responses that were either
extremely slow or crashed completely, by switching to incremental streaming output collection.
#4960
Fixed a duplciate wasm export in node ESM atomics, when compiled in debug mode
#5028
Fixed a type inference regression (
E0283: type annotations needed) introducedin v0.2.109 where the stable
FromIteratorandExtendimpls onjs_sys::Arraywere changed from
A: AsRef<JsValue>toA: AsRef<T>. Because#[wasm_bindgen]generates multiple
AsRefimpls per type, the compiler could not uniquely resolveT, breaking code likeArray::from_iter([my_wasm_value])without explicitannotations. The stable impls are restored to
A: AsRef<JsValue>(returningArray<JsValue>); the genericA: AsRef<T>forms remain available underjs_sys_unstable_apis.#5052
Fixed
skip_typescriptnot being respected when usingreexport, causingTypeScript definitions to be incorrectly emitted for re-exported items marked
with
#[wasm_bindgen(skip_typescript)].#5051
Removed
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.