⌘K
rustc
all
The Rust compiler. Rust projects usually use `cargo` instead of invoking `rustc` directly.
More info →Options (1)
-C, --codegenbooleanCompile with optimizations (`s` means optimize for binary size; `z` is the same with even more optimizations)
Example:
rustc {{[-C|--codegen]}} lto {{[-C|--codegen]}} opt-level={{0|1|2|3|s|z}} {{path/to/main.rs}}Examples (7)
Compile a binary crate
rustc path/to/main.rsCompile with optimizations (`s` means optimize for binary size; `z` is the same with even more optimizations)
rustc [-C|--codegen] lto [-C|--codegen] opt-level=0|1|2|3|s|z path/to/main.rsCompile with debugging information
rustc -g path/to/main.rsExplain an error message
rustc --explain error_codeCompile with architecture-specific optimizations for the current CPU
rustc [-C|--codegen] target-cpu=native path/to/main.rsDisplay the target list (Note: You have to add a target using `rustup` first to be able to compile for it)
rustc --print target-listCompile for a specific target
rustc --target target_triple path/to/main.rsmade by @shridhargupta | data from tldr-pages