Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really wish there was some work on hermetic compilation of crates. Ideally crates would be able to opt-in (eventually opt-out) to "pure" mode which would mean they can't use `build.rs`, proc macros are fully sandboxed, no `env!()` and so on.

Without that you can't really do distributed and cached compilation 100% reliably.



That would help some stuff, but it wouldn’t help with monomorphized code or macro expansion. Those two are the real killers in terms of compilation performance. And in both of those cases, most of the compilation work happens at the call site - when compiling your library.


Eiffel, Ada, D, C++ with extern templates (even better if modules are also part of the story) show ways how this can be improved.

Naturally somehow has to spend time analysing how their way maps into Rust compilation story.


Would it not allow macro expansion to be cached? Which I believe it can't be currently because macros can run arbitrary code and access arbitrary external state.


Those are simply different problems though. Macro expansion is not even exactly a problem.

For monomorphized code the compiler just needs a mode where it automatically does what the Momo crate does.

For proc macros the Watt crate (precompiled WASM macros) will make a big difference. It just needs official sanction and integration.

Anyway yeah those are totally separate problems to caching and distributed builds.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: