• Sources: primary, discussion
  • Summary: This is the first public experimental preview of wasm32-unknown-emscripten support in wasm-bindgen and Rust Workers, and a new -sWASM_BINDGEN mode resolves the long-standing conflict where both toolchains assumed they owned loading and JavaScript generation, so Emscripten drives the build and provides the companion JS while wasm-bindgen emits a smaller portable bindings file into Emscripten's library system. Because Emscripten already satisfies target_family = unix in Rust, many libraries work unchanged, and the patches needed for libc, socket2 and Mio were mostly adding an emscripten target_os value to existing platform gates. Tokio is the hard part, since Workers are single-threaded inside a JS event loop and Tokio's blocking operations assume threaded parking, so Cloudflare implemented both a JSPI path, which additionally requires swapping the thread-local runtime context on every enter, exit, suspend and resume because a stack switch is not a thread switch, and a full event-loop runtime.
  • Why it matters: The Tokio patchsets are still under upstream review with only the first target-support patch landed, so this is a direction to track rather than a target to build on, demonstrated by a Rust-native Minecraft server running inside a Durable Object over real TCP sockets.

send feedback on this story