SYSTEM Cited by 1 source
wasm-bindgen¶
wasm-bindgen
is the core Rust project that generates the
Rust↔JavaScript bindings every Rust-on-Wasm runtime depends on
— including Rust Workers. It walks the
Rust source to emit a paired Wasm module + JS glue so that
Rust types, exported functions, async functions, and closures
can be called from JavaScript and vice versa, and so that
async Rust can reject JS Promises with typed errors.
Role on this wiki¶
Canonical wiki instance of co-maintained critical-path infrastructure on the Rust Wasm stack. Cloudflare became part of the wasm-bindgen organization formed in 2025 (replacing the sunset rustwasm GitHub org) alongside the Rust WebAssembly working group and independent maintainers, and used that role to move Rust-Workers reliability fixes from a platform-private wrapper into the shared project.
What Cloudflare's 2026-04 work added¶
panic=unwindsupport forwasm32-unknown-unknown— wasm-bindgen now generates exports that catch panics at the Rust↔JS boundary and surface them as JavaScriptPanicErrorexceptions, using the WebAssembly Exception Handling proposal.- Walrus exception-
handling support — the WebAssembly parser wasm-bindgen
uses had to be taught
try/catchinstructions; the descriptor interpreter had to evaluate exception-handling blocks. extern "C-unwind"on exports so Rust doesn't abort when a foreign exception unwinds through the boundary.MaybeUnwindSafetrait +Closure::new_abortingvariants — see concepts/unwind-safety. The aborting variants terminate on panic when unwind-safety of captured state can't be proven, avoiding theAssertUnwindSafe-footgun.Exception.Tagfor foreign exceptions — lets embedders distinguish recoverable unwinds from genuine aborts at the JS boundary. "We chose to mark all errors which are definitely unwinds."set_on_aborthook — attach a handler at initialization time that recovers from aborts according to the embedder's needs. Canonical wiki instance of concepts/abort-recovery.--reset-state-function(experimental) — exposes a function on the generated bindings that lets the Rust application request that its Wasm instance be reset to initial state on the next call. Benefits wasm-bindgen libraries imported by JS apps; class instances from the old Wasm instance throw (handles orphaned), new constructors work. "The JS application using a Wasm library is errored but not bricked."- Modern-exception-handling migration plan — "over the
coming months, we'll be working to make the transition to
stable
panic=unwindand modern Exception Handling as invisible as possible to end users." Rust Wasm targets still default to the legacy variant today.
The reliability failure class wasm-bindgen now contains¶
Before: a single Rust panic or abort left the Wasm instance
in an undefined state, so that instance could no longer serve
any request safely — the
sandbox poisoning class.
After: panics unwind cleanly with destructors running and the
instance remaining valid; aborts route through the
set_on_abort hook for embedder-controlled recovery.
"Implementing critical error recovery as the last line of
defence ensures execution correctness and that future
operations will be able to succeed. The invalid state does
not persist, ensuring a single failure does not cascade into
multiple failures."
Seen in¶
- sources/2026-04-22-cloudflare-making-rust-workers-reliable-panic-and-abort-recovery-in-wasm-bindgen
— canonical wiki instance. Cloudflare's panic-unwind +
abort-recovery contributions landing in wasm-bindgen proper
rather than in workers-rs, plus the
Walrus parser extension,
--reset-state-function, and the modern-EH migration commitment.
Related¶
- systems/workers-rs — primary consumer in Cloudflare's product stack.
- systems/webassembly — the runtime substrate whose
Exception Handling proposal unlocks
panic=unwind. - systems/cloudflare-workers — production deployment surface benefiting from upstream fixes.
- systems/v8-javascript-engine / systems/nodejs — Wasm Exception Handling consumers; Cloudflare backported modern EH to Node 22 / 24 to keep wasm-bindgen's default target viable.
- concepts/panic-unwind / concepts/webassembly-exception-handling / concepts/abort-recovery / concepts/unwind-safety / concepts/sandbox-poisoning.
- patterns/upstream-the-fix — the contribution shape Cloudflare's co-maintainer role enables.
- companies/cloudflare — co-maintainer.