1 .TH RUSTC "1" "March 2014" "rustc 0.13.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 native 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]
56 Configure the output that \fBrustc\fR will produce.
58 \fB\-\-print\fR [crate\-name|file\-names|sysroot]
59 Comma separated list of compiler information to print on stdout.
62 Equivalent to \fI\-C\ debuginfo=2\fR.
65 Equivalent to \fI\-C\ opt\-level=2\fR.
67 \fB\-o\fR \fIFILENAME\fR
68 Write output to \fIFILENAME\fR.
69 Ignored if multiple \fI\-\-emit\fR outputs are specified.
71 \fB\-\-out\-dir\fR \fIDIR\fR
72 Write output to compiler\[hy]chosen filename in \fIDIR\fR.
73 Ignored if \fI\-o\fR is specified.
74 Defaults to the current directory.
76 \fB\-\-explain\fR \fIOPT\fR
77 Provide a detailed explanation of an error message.
82 \fB\-\-target\fR \fITRIPLE\fR
83 Target triple \fIcpu\fR\-\fImanufacturer\fR\-\fIkernel\fR[\-\fIos\fR]
84 to compile for (see chapter 3.4 of
85 .UR http://www.sourceware.org/autobook/
90 Print 'lint' options and default settings.
92 \fB\-W\fR \fIOPT\fR, \fB\-\-warn\fR \fIOPT\fR
95 \fB\-A\fR \fIOPT\fR, \fB\-\-allow\fR \fIOPT\fR
98 \fB\-D\fR \fIOPT\fR, \fB\-\-deny\fR \fIOPT\fR
101 \fB\-F\fR \fIOPT\fR, \fB\-\-forbid\fR \fIOPT\fR
104 \fB\-C\fR \fIFLAG\fR[=\fIVAL\fR], \fB\-\-codegen\fR \fIFLAG\fR[=\fIVAL\fR]
105 Set a codegen\[hy]related flag to the value specified.
106 Use \fI\-C help\fR to print available flags.
107 See CODEGEN OPTIONS below.
109 \fB\-V\fR, \fB\-\-version\fR
110 Print version info and exit.
112 \fB\-v\fR, \fB\-\-verbose\fR
115 \fB\-\-extern\fR \fINAME\fR=\fIPATH\fR
116 Specify where an external rust library is located.
118 \fB\-\-sysroot\fR \fIPATH\fR
119 Override the system root.
122 Set internal debugging options.
123 Use \fI\-Z help\fR to print available options.
125 \fB\-\-color\fR auto|always|never
126 Configure coloring of output:
130 colorize, if output goes to a tty (default);
133 always colorize output;
136 never colorize output.
142 \fBar\fR=\fI/path/to/ar\fR
143 Path to the archive utility to use when assembling archives.
145 \fBlinker\fR=\fI/path/to/cc\fR
146 Path to the linker utility to use when linking libraries, executables, and
149 \fBlink\-args\fR='\fI\-flag1 \-flag2\fR'
150 A space\[hy]separated list of extra arguments to pass to the linker when the linker
154 Perform LLVM link\[hy]time optimizations.
156 \fBtarget\-cpu\fR=\fIhelp\fR
157 Selects a target processor.
158 If the value is 'help', then a list of available CPUs is printed.
160 \fBtarget\-feature\fR='\fI+feature1\fR,\fI\-feature2\fR'
161 A comma\[hy]separated list of features to enable or disable for the target.
162 A preceding '+' enables a feature while a preceding '\-' disables it.
163 Available features can be discovered through \fItarget\-cpu=help\fR.
165 \fBpasses\fR=\fIval\fR
166 A space\[hy]separated list of extra LLVM passes to run.
167 A value of 'list' will cause \fBrustc\fR to print all known passes and
169 The passes specified are appended at the end of the normal pass manager.
171 \fBllvm\-args\fR='\fI\-arg1\fR \fI\-arg2\fR'
172 A space\[hy]separated list of arguments to pass through to LLVM.
175 If specified, the compiler will save more files (.bc, .o, .no\-opt.bc) generated
176 throughout compilation in the output directory.
179 If specified, then the rpath value for dynamic libraries will be set in
180 either dynamic library or executable outputs.
182 \fBno\-prepopulate\-passes\fR
183 Suppresses pre\[hy]population of the LLVM pass manager that is run over the module.
185 \fBno\-vectorize\-loops\fR
186 Suppresses running the loop vectorization LLVM pass, regardless of optimization
189 \fBno\-vectorize\-slp\fR
190 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
194 Generates software floating point library calls instead of hardware
197 \fBprefer\-dynamic\fR
198 Prefers dynamic linking to static linking.
200 \fBno\-integrated\-as\fR
201 Force usage of an external assembler rather than LLVM's integrated one.
204 Disable the use of the redzone.
206 \fBrelocation\-model\fR=[pic,static,dynamic\-no\-pic]
207 The relocation model to use.
210 \fBcode\-model\fR=[small,kernel,medium,large]
211 Choose the code model to use.
213 \fBmetadata\fR=\fIval\fR
214 Metadata to mangle symbol names with.
216 \fBextra\-filename\fR=\fIval\fR
217 Extra data to put in each output filename.
219 \fBcodegen\-units\fR=\fIn\fR
220 Divide crate into \fIn\fR units to optimize in parallel.
222 \fBremark\fR=\fIval\fR
223 Print remarks for these optimization passes (space separated, or "all").
225 \fBno\-stack\-check\fR
226 Disable checks for stack exhaustion (a memory\[hy]safety hazard!).
228 \fBdebuginfo\fR=\fIval\fR
229 Debug info emission level:
236 line\[hy]tables only (for stacktraces and breakpoints);
239 full debug info with variable and type information.
242 \fBopt\-level\fR=\fIVAL\fR
243 Optimize with possible levels 0\[en]3
246 To build an executable from a source file with a main function:
247 $ rustc \-o hello hello.rs
249 To build a library from a source file:
250 $ rustc \-\-crate\-type=lib hello\-lib.rs
252 To build either with a crate (.rs) file:
255 To build an executable with debug info:
256 $ rustc \-g \-o hello hello.rs
264 .UR https://github.com/rust\-lang/rust/issues
269 See \fIAUTHORS.txt\fR in the Rust source distribution.
272 This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
273 See \fICOPYRIGHT\fR file in the rust source distribution.