@@ -4,54 +4,113 @@ Here's a list of command-line arguments to `rustc` and what they do.
44
55## ` -h ` /` --help ` : get help
66
7+ This flag will print out help information for ` rustc ` .
8+
79## ` --cfg ` : configure the compilation environment
810
9- ## ` -L ` : add a directory to the library search path.
11+ This flag can turn on or off various ` #[cfg] ` settings.
12+
13+ ## ` -L ` : add a directory to the library search path
14+
15+ When looking for external crates, a directory passed to this flag will be searched.
1016
1117## ` -l ` : link the generated crate to a native library
1218
19+ This flag allows you to specify linking to a specific native library when building
20+ a crate.
21+
1322## ` --crate-type ` : a list of types of crates for the compiler to emit
1423
24+ This instructs ` rustc ` on which crate type to build.
25+
1526## ` --crate-name ` : specify the name of the crate being built
1627
28+ This informs ` rustc ` of the name of your crate.
29+
1730## ` --emit ` : emit output other than a crate
1831
32+ Instead of producing a crate, this flag can print out things like the assembly or LLVM-IR.
33+
1934## ` --print ` : print compiler information
2035
36+ This flag prints out various information about the compiler.
37+
2138## ` -g ` : include debug information
2239
40+ A synonym for ` -C debug-level=2 ` .
41+
2342## ` -O ` : optimize your code
2443
44+ A synonym for ` -C opt-level=2 ` .
45+
2546## ` -o ` : filename of the output
2647
48+ This flag controls the output filename.
49+
2750## ` --out-dir ` : directory to write the output in
2851
52+ The outputted crate will be written to this directory.
53+
2954## ` --explain ` : provide a detailed explanation of an error message
3055
56+ Each error of ` rustc ` 's comes with an error code; this will print
57+ out a longer explanation of a given error.
58+
3159## ` --test ` : build a test harness
3260
61+ When compiling this crate, ` rustc ` will ignore your ` main ` function
62+ and instead produce a test harness.
63+
3364## ` --target ` : select a target triple to build
3465
66+ This controls which [ target] ( targets/index.html ) to produce.
67+
3568## ` -W ` : set lint warnings
3669
70+ This flag will set which lints should be set to the [ warn level] ( lints/levels.html#warn ) .
71+
3772## ` -A ` : set lint allowed
3873
74+ This flag will set which lints should be set to the [ allow level] ( lints/levels.html#allow ) .
75+
3976## ` -D ` : set lint denied
4077
78+ This flag will set which lints should be set to the [ deny level] ( lints/levels.html#deny ) .
79+
4180## ` -F ` : set lint forbidden
4281
82+ This flag will set which lints should be set to the [ forbid level] ( lints/levels.html#forbid ) .
83+
4384## ` --cap-lints ` : set the most restrictive lint level
4485
86+ This flag lets you 'cap' lints, for more, [ see here] ( lints/levels.html#capping-lints ) .
87+
4588## ` -C ` /` --codegen ` : code generation options
4689
90+ This flag will allow you to set [ codegen options] ( codegen-options/index.html ) .
91+
4792## ` -V ` /` --verision ` : print a version
4893
94+ This flag will print out ` rustc ` 's version.
95+
4996## ` -v ` /` --verbose ` : use verbose output
5097
98+ This flag, when combined with other flags, makes them produce extra output.
99+
51100## ` --extern ` : specify where an external library is located
52101
102+ This flag allows you to pass the name and location of an external crate that will
103+ be linked into the crate you're buildling.
104+
53105## ` --sysroot ` : Override the system root
54106
107+ The "sysroot" is where ` rustc ` looks for the crates that come with the Rust
108+ distribution; this flag allows that to be overridden.
109+
55110## ` --error-format ` : control how errors are produced
56111
57- ## ` --color ` : configur coloring of output
112+ This flag lets you control the format of errors.
113+
114+ ## ` --color ` : configur coloring of output
115+
116+ This flag lets you control color settings of the output.
0 commit comments