Stream: cranelift

Topic: Running rust Compiler within Chrome WASM Sandbox?


view this post on Zulip MT (Sep 27 2025 at 14:12):

Would it be possible for a rust compiler to run inside the browser WASM sandbox? If so could this rust compiler running inside chrome be used to compile rust code inside the WASM sandbox of Chrome? Are there any super simple rustc/llvm, cranelift etc alternative compilers that can compile to WASM? A quick search shows even Cranelift with its 100x fewer lines of code than rustc still cannot be compiled to WASM.

view this post on Zulip bjorn3 (Sep 27 2025 at 17:29):

You can compile rustc to wasi with a couple of small patches (disabling threads, disabling sysroot auto detection, setting cg_clif as codegen backend) and then run this in the browser using https://github.com/bjorn3/browser_wasi_shim/. See examples/rustc.html.

A WASI shim for in the browser. Contribute to bjorn3/browser_wasi_shim development by creating an account on GitHub.

view this post on Zulip bjorn3 (Sep 27 2025 at 17:31):

See also https://garriga.dev/rubri/ and https://github.com/oligamiq/rubrc

Rust compiler that runs in the browser! Contribute to oligamiq/rubrc development by creating an account on GitHub.

Last updated: Dec 06 2025 at 07:03 UTC