Comment by shakna
Any language that supports constexpr, like Rust's const fn [0], can execute arbitrary code at compile time.
Any language that supports constexpr, like Rust's const fn [0], can execute arbitrary code at compile time.
That's all interesting about const fns, but AFAIK any dependency can add a build.rs that executes anything - and is usually automatically executed by the language server doing a build on Cargo.toml file change.
Not a Rust-only problem, but one that people should be aware of in general.
Rust's const fns run in a restricted interpreter that does not allow for things like non-determinism, syscalls, unsound behavior, etc. They can neither read from nor write to "the environment" in any meaningful way. They don't even expose things like the host's pointer-size to the code being run.