1 .TH RUSTC "1" "August 2015" "rustc 1.2.0" "User Commands"
3 rustc \- The Rust compiler
6 [\fIOPTIONS\fR] \fIINPUT\fR
9 This program is a compiler for the Rust language, available at
10 .UR https://www.rust\-lang.org
16 \fB\-h\fR, \fB\-\-help\fR
17 Display the help message.
19 \fB\-\-cfg\fR \fISPEC\fR
20 Configure the compilation environment.
22 \fB\-L\fR [\fIKIND\fR=]\fIPATH\fR
23 Add a directory to the library search path.
24 The optional \fIKIND\fR can be one of:
28 only lookup transitive dependencies here
31 only lookup local `extern crate` directives here
34 only lookup native libraries here
37 only look for OSX frameworks here
40 look for anything here (the default)
43 \fB\-l\fR [\fIKIND\fR=]\fINAME\fR
44 Link the generated crate(s) to the specified library \fINAME\fR.
45 The optional \fIKIND\fR can be one of \fIstatic\fR, \fIdylib\fR, or
47 If omitted, \fIdylib\fR is assumed.
49 \fB\-\-crate\-type\fR [bin|lib|rlib|dylib|staticlib]
50 Comma separated list of types of crates for the compiler to emit.
52 \fB\-\-crate\-name\fR \fINAME\fR
53 Specify the name of the crate being built.
55 \fB\-\-emit\fR [asm|llvm\-bc|llvm\-ir|obj|link|dep\-info][=\fIPATH\fR]
56 Configure the output that \fBrustc\fR will produce.
58 Each emission may also have an optional explicit output \fIPATH\fR specified for that particular
59 emission kind. This path takes precedence over the \fB-o\fR option.
61 \fB\-\-print\fR [crate\-name|file\-names|sysroot]
62 Comma separated list of compiler information to print on stdout.
65 Equivalent to \fI\-C\ debuginfo=2\fR.
68 Equivalent to \fI\-C\ opt\-level=2\fR.
70 \fB\-o\fR \fIFILENAME\fR
71 Write output to \fIFILENAME\fR.
72 Ignored if multiple \fI\-\-emit\fR outputs are specified which don't have an
73 explicit path otherwise.
75 \fB\-\-out\-dir\fR \fIDIR\fR
76 Write output to compiler\[hy]chosen filename in \fIDIR\fR.
77 Ignored if \fI\-o\fR is specified.
78 Defaults to the current directory.
80 \fB\-\-explain\fR \fIOPT\fR
81 Provide a detailed explanation of an error message.
86 \fB\-\-target\fR \fITRIPLE\fR
87 Target triple \fIcpu\fR\-\fImanufacturer\fR\-\fIkernel\fR[\-\fIos\fR]
88 to compile for (see chapter 3.4 of
89 .UR http://www.sourceware.org/autobook/
94 Print 'lint' options and default settings.
96 \fB\-W\fR \fIOPT\fR, \fB\-\-warn\fR \fIOPT\fR
99 \fB\-A\fR \fIOPT\fR, \fB\-\-allow\fR \fIOPT\fR
102 \fB\-D\fR \fIOPT\fR, \fB\-\-deny\fR \fIOPT\fR
105 \fB\-F\fR \fIOPT\fR, \fB\-\-forbid\fR \fIOPT\fR
108 \fB\-C\fR \fIFLAG\fR[=\fIVAL\fR], \fB\-\-codegen\fR \fIFLAG\fR[=\fIVAL\fR]
109 Set a codegen\[hy]related flag to the value specified.
110 Use \fI\-C help\fR to print available flags.
111 See CODEGEN OPTIONS below.
113 \fB\-V\fR, \fB\-\-version\fR
114 Print version info and exit.
116 \fB\-v\fR, \fB\-\-verbose\fR
119 \fB\-\-extern\fR \fINAME\fR=\fIPATH\fR
120 Specify where an external rust library is located. These should match
121 \fIextern\fR declarations in the crate's source code.
123 \fB\-\-sysroot\fR \fIPATH\fR
124 Override the system root.
127 Set internal debugging options.
128 Use \fI\-Z help\fR to print available options.
130 \fB\-\-color\fR auto|always|never
131 Configure coloring of output:
135 colorize, if output goes to a tty (default);
138 always colorize output;
141 never colorize output.
147 \fBar\fR=\fI/path/to/ar\fR
148 Path to the archive utility to use when assembling archives.
150 \fBlinker\fR=\fI/path/to/cc\fR
151 Path to the linker utility to use when linking libraries, executables, and
154 \fBlink\-args\fR='\fI\-flag1 \-flag2\fR'
155 A space\[hy]separated list of extra arguments to pass to the linker when the linker
159 Perform LLVM link\[hy]time optimizations.
161 \fBtarget\-cpu\fR=\fIhelp\fR
162 Selects a target processor.
163 If the value is 'help', then a list of available CPUs is printed.
165 \fBtarget\-feature\fR='\fI+feature1\fR,\fI\-feature2\fR'
166 A comma\[hy]separated list of features to enable or disable for the target.
167 A preceding '+' enables a feature while a preceding '\-' disables it.
168 Available features can be discovered through \fIllc -mcpu=help\fR.
170 \fBpasses\fR=\fIval\fR
171 A space\[hy]separated list of extra LLVM passes to run.
172 A value of 'list' will cause \fBrustc\fR to print all known passes and
174 The passes specified are appended at the end of the normal pass manager.
176 \fBllvm\-args\fR='\fI\-arg1\fR \fI\-arg2\fR'
177 A space\[hy]separated list of arguments to pass through to LLVM.
180 If specified, the compiler will save more files (.bc, .o, .no\-opt.bc) generated
181 throughout compilation in the output directory.
184 If specified, then the rpath value for dynamic libraries will be set in
185 either dynamic library or executable outputs.
187 \fBno\-prepopulate\-passes\fR
188 Suppresses pre\[hy]population of the LLVM pass manager that is run over the module.
190 \fBno\-vectorize\-loops\fR
191 Suppresses running the loop vectorization LLVM pass, regardless of optimization
194 \fBno\-vectorize\-slp\fR
195 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
199 Generates software floating point library calls instead of hardware
202 \fBprefer\-dynamic\fR
203 Prefers dynamic linking to static linking.
205 \fBno\-integrated\-as\fR
206 Force usage of an external assembler rather than LLVM's integrated one.
209 Disable the use of the redzone.
211 \fBrelocation\-model\fR=[pic,static,dynamic\-no\-pic]
212 The relocation model to use.
215 \fBcode\-model\fR=[small,kernel,medium,large]
216 Choose the code model to use.
218 \fBmetadata\fR=\fIval\fR
219 Metadata to mangle symbol names with.
221 \fBextra\-filename\fR=\fIval\fR
222 Extra data to put in each output filename.
224 \fBcodegen\-units\fR=\fIn\fR
225 Divide crate into \fIn\fR units to optimize in parallel.
227 \fBremark\fR=\fIval\fR
228 Print remarks for these optimization passes (space separated, or "all").
230 \fBno\-stack\-check\fR
231 Disable checks for stack exhaustion (a memory\[hy]safety hazard!).
233 \fBdebuginfo\fR=\fIval\fR
234 Debug info emission level:
241 line\[hy]tables only (for stacktraces and breakpoints);
244 full debug info with variable and type information.
247 \fBopt\-level\fR=\fIVAL\fR
248 Optimize with possible levels 0\[en]3
252 Some of these affect the output of the compiler, while others affect programs
253 which link to the standard library.
256 \fBRUST_TEST_THREADS\fR
257 The test framework Rust provides executes tests in parallel. This variable sets
258 the maximum number of threads used for this purpose.
261 \fBRUST_TEST_NOCAPTURE\fR
262 A synonym for the --nocapture flag.
266 Sets the minimum stack size for new threads.
270 If set, produces a backtrace in the output of a program which panics.
273 To build an executable from a source file with a main function:
274 $ rustc \-o hello hello.rs
276 To build a library from a source file:
277 $ rustc \-\-crate\-type=lib hello\-lib.rs
279 To build either with a crate (.rs) file:
282 To build an executable with debug info:
283 $ rustc \-g \-o hello hello.rs
291 .UR https://github.com/rust\-lang/rust/issues
296 See \fIAUTHORS.txt\fR in the Rust source distribution.
299 This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
300 See \fICOPYRIGHT\fR file in the rust source distribution.