@@ -4,54 +4,113 @@ Here's a list of command-line arguments to `rustc` and what they do.
4
4
5
5
## ` -h ` /` --help ` : get help
6
6
7
+ This flag will print out help information for ` rustc ` .
8
+
7
9
## ` --cfg ` : configure the compilation environment
8
10
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.
10
16
11
17
## ` -l ` : link the generated crate to a native library
12
18
19
+ This flag allows you to specify linking to a specific native library when building
20
+ a crate.
21
+
13
22
## ` --crate-type ` : a list of types of crates for the compiler to emit
14
23
24
+ This instructs ` rustc ` on which crate type to build.
25
+
15
26
## ` --crate-name ` : specify the name of the crate being built
16
27
28
+ This informs ` rustc ` of the name of your crate.
29
+
17
30
## ` --emit ` : emit output other than a crate
18
31
32
+ Instead of producing a crate, this flag can print out things like the assembly or LLVM-IR.
33
+
19
34
## ` --print ` : print compiler information
20
35
36
+ This flag prints out various information about the compiler.
37
+
21
38
## ` -g ` : include debug information
22
39
40
+ A synonym for ` -C debug-level=2 ` .
41
+
23
42
## ` -O ` : optimize your code
24
43
44
+ A synonym for ` -C opt-level=2 ` .
45
+
25
46
## ` -o ` : filename of the output
26
47
48
+ This flag controls the output filename.
49
+
27
50
## ` --out-dir ` : directory to write the output in
28
51
52
+ The outputted crate will be written to this directory.
53
+
29
54
## ` --explain ` : provide a detailed explanation of an error message
30
55
56
+ Each error of ` rustc ` 's comes with an error code; this will print
57
+ out a longer explanation of a given error.
58
+
31
59
## ` --test ` : build a test harness
32
60
61
+ When compiling this crate, ` rustc ` will ignore your ` main ` function
62
+ and instead produce a test harness.
63
+
33
64
## ` --target ` : select a target triple to build
34
65
66
+ This controls which [ target] ( targets/index.html ) to produce.
67
+
35
68
## ` -W ` : set lint warnings
36
69
70
+ This flag will set which lints should be set to the [ warn level] ( lints/levels.html#warn ) .
71
+
37
72
## ` -A ` : set lint allowed
38
73
74
+ This flag will set which lints should be set to the [ allow level] ( lints/levels.html#allow ) .
75
+
39
76
## ` -D ` : set lint denied
40
77
78
+ This flag will set which lints should be set to the [ deny level] ( lints/levels.html#deny ) .
79
+
41
80
## ` -F ` : set lint forbidden
42
81
82
+ This flag will set which lints should be set to the [ forbid level] ( lints/levels.html#forbid ) .
83
+
43
84
## ` --cap-lints ` : set the most restrictive lint level
44
85
86
+ This flag lets you 'cap' lints, for more, [ see here] ( lints/levels.html#capping-lints ) .
87
+
45
88
## ` -C ` /` --codegen ` : code generation options
46
89
90
+ This flag will allow you to set [ codegen options] ( codegen-options/index.html ) .
91
+
47
92
## ` -V ` /` --verision ` : print a version
48
93
94
+ This flag will print out ` rustc ` 's version.
95
+
49
96
## ` -v ` /` --verbose ` : use verbose output
50
97
98
+ This flag, when combined with other flags, makes them produce extra output.
99
+
51
100
## ` --extern ` : specify where an external library is located
52
101
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
+
53
105
## ` --sysroot ` : Override the system root
54
106
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
+
55
110
## ` --error-format ` : control how errors are produced
56
111
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