Here's a list of command-line arguments to rustc
and what they do.
This flag will print out help information for rustc
.
This flag can turn on or off various #[cfg]
settings.
When looking for external crates, a directory passed to this flag will be searched.
This flag allows you to specify linking to a specific native library when building a crate.
This instructs rustc
on which crate type to build.
This informs rustc
of the name of your crate.
Instead of producing a crate, this flag can print out things like the assembly or LLVM-IR.
This flag prints out various information about the compiler.
A synonym for -C debug-level=2
.
A synonym for -C opt-level=2
.
This flag controls the output filename.
The outputted crate will be written to this directory.
Each error of rustc
's comes with an error code; this will print
out a longer explanation of a given error.
When compiling this crate, rustc
will ignore your main
function
and instead produce a test harness.
This controls which target to produce.
This flag will set which lints should be set to the warn level.
This flag will set which lints should be set to the allow level.
This flag will set which lints should be set to the deny level.
This flag will set which lints should be set to the forbid level.
This flag lets you 'cap' lints, for more, see here.
This flag will allow you to set codegen options.
This flag will print out rustc
's version.
This flag, when combined with other flags, makes them produce extra output.
This flag allows you to pass the name and location of an external crate that will be linked into the crate you're buildling.
The "sysroot" is where rustc
looks for the crates that come with the Rust
distribution; this flag allows that to be overridden.
This flag lets you control the format of errors.
This flag lets you control color settings of the output.