Rustc --run flag To run binary once it is built

Please add a flag such as --run to have the binary run automatically once the binary is built

rustc --run main.rs

This seems higher-level than rustc should have. cargo run exists, and cargo also has (experimentally on nightly) a script mode; both of those seem like better fits for this than rustc. In particular, whatever tool is driving rustc could easily do this itself.

8 Likes

Is rustc going to be deprecated over cargo run?

Cargo internally uses rustc and adds dependency management and a build system on top. So no, rustc will not be deprecated. It is just not meant to be invoked directly by the user in almost all cases.

2 Likes