Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Rust Blog Unknown date 8 min read Announcement mediumAdept

C ABI Changes for `wasm32-unknown-unknown` | Rust Blog

Rust is switching the `extern "C"` ABI on `wasm32-unknown-unknown` from a legacy non-standard definition to the WebAssembly tool-conventions C ABI, which changes generated binaries. The key difference is that the legacy ABI "splats" by-value structs into separate wasm parameters, while the standard ABI passes them indirectly through linear memory. wasm-bindgen was already fixed, but other projects still rely on the old behavior. To check exposure, build with nightly-2025-03-27 or later, watch for the new future-incompat warning (stable in 1.87.0), and test with `-Zwasm-c-abi=spec`. Affected projects can pin the compiler, adopt the spec ABI on nightly, or stop passing structs by value (e.g. pass `&Pair`) before the legacy flag is removed around summer 2025.

Assumes: Rust FFI and extern "C"WebAssembly basicsCalling conventions/ABIs

Related posts

  • Extensible Language Support in Zed - Part 1

    Zed mediumAdept

    Zed loads third-party Tree-sitter grammars as WebAssembly modules using a hybrid design. Native code consumes the parser's static parse tables after they are copied out of wasm linear memory, while only the lexing functions, including hand-written external scanners, run inside Wasmtime. This avoids depending on the user's C compiler and keeps buggy scanners from crashing the editor. It also avoids copying large syntax trees out of wasm memory on every keystroke. A new `WasmStore` API lets wasm-loaded languages behave identically to native ones, and a bundled mini-libc with a bump allocator that is reset each parse makes scanner memory leaks impossible.

  • Announcing Rust 1.99.1

    Rust Blog mediumAdept

    Rust 1.99.1 is a point release fixing three regressions. LLVM's loop-idiom-wcslen pass could emit calls to `wcslen` on targets lacking it, breaking UEFI builds using `std`, so compiler-builtins now provides a fallback. FFI functions returning `bool` on x86_64 could leave bits 1-7 of the return register unspecified; the return type is again marked for zero-extension as the ABI requires. `rust-lld` on macOS could fail to load libLLVM when invoked without the rustup proxy and now carries an rpath entry for libLLVM.dylib.

  • Contributing support for a Wasm instruction to Winch

    Shopify Engineering hardMaster

    Adding a WebAssembly instruction to Winch, Wasmtime's baseline non-optimizing compiler, touches several layers: the wasmparser VisitOperator visitor, the CodeGenContext that manages the value stack, register allocation and spilling, an ISA-independent MacroAssembler, and an x86_64 assembler built on Cranelift's ISLE-generated instruction definitions. The i32.clz example shows how the MacroAssembler emits lzcnt when the CPU supports it and otherwise falls back to a bsr/setne sequence. Changes are tested in two ways: filetests check the emitted machine code without running it, so they work on AArch64 Macs, and differential fuzzing on x86_64 hardware compares Winch's results against another Wasm engine.

  • WebAssembly functions for your SQLite-compatible database

    Turso mediumAdept

    libSQL, Turso's open-contribution fork of SQLite, adds user-defined functions written in WebAssembly and registered directly from SQL with a CREATE FUNCTION ... LANGUAGE wasm statement, instead of only through SQLite's C API. WebAssembly was chosen for its sandboxing, portability, performance and wide use as a compile target from languages such as Rust and Zig. A walkthrough compiles Rust encrypt/decrypt functions with the libsql_bindgen crate or its playground and loads them as binary blobs in the libSQL shell. Functions cannot touch system resources such as time, randomness or the network, and their signatures must map to INTEGER, REAL, TEXT and BLOB types.

  • WebAssembly JSPI has a new API

    V8 mediumAdept

    WebAssembly JavaScript Promise Integration (JSPI) ships a revised API in Chrome M126 that drops explicit Suspender objects and instead uses the most recent JS-to-Wasm export call as the suspension cut point. The new API consists of WebAssembly.promising() to wrap exports and a WebAssembly.Suspending constructor to mark imports, removing the dependency on the Type Reflection proposal. Suspending imports now only suspend when the JS function actually returns a Promise, which avoids unnecessary event-loop trips. Emscripten 3.1.61+ users need no code changes, the old API is removed after Chrome M128, and V8 is working on growable (segmented) stacks so that millions of suspended coroutines become feasible.

The quest for software engineering knowledge.

Look:
Layout: