At least Linux, OpenBSD, and (with more annoyance) Windows make it relatively straightforward to run things like build.rs in a sandbox. I wonder why Cargo doesn’t do this.

There was also a project (that dtolnay was involved in, I believe!) a few years ago to compile proc macros to wasm.

EDIT: I'm wrong, it's not watt -- just shared the same package name.

This looks like a better link:

https://github.com/dtolnay/watt

This would be a lot more compelling if it were integrated into rustc and cargo.