rustc Command Examples

The Rust compiler. Rust projects usually use cargo instead of invoking rustc directly. More information: https://doc.rust-lang.org/rustc.

rustc {{path/to/main.rs}}

rustc -C lto -C opt-level={{0|1|2|3|s|z}} {{path/to/main.rs}}

rustc -g {{path/to/main.rs}}

rustc --explain {{error_code}}

rustc -C target-cpu={{native}} {{path/to/main.rs}}

rustc --print target-list

rustc --target {{target_triple}} {{path/to/main.rs}}