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 <\fBhttps://www.rust-lang.org\fR>.
15 \fB\-h\fR, \fB\-\-help\fR
16 Display the help message
19 Configure the compilation environment
22 Add a directory to the library search path. The optional KIND can be one of:
23 dependency = only lookup transitive dependencies here
24 crate = only lookup local `extern crate` directives here
25 native = only lookup native libraries here
26 framework = only look for OSX frameworks here
27 all = look for anything here (the default)
30 Link the generated crate(s) to the specified native library NAME. The optional
31 KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.
33 \fB\-\-crate-type\fR [bin|lib|rlib|dylib|staticlib]
34 Comma separated list of types of crates for the compiler to emit
36 \fB\-\-crate-name NAME\fR
37 Specify the name of the crate being built
39 \fB\-\-emit\fR [asm|llvm-bc|llvm-ir|obj|link|dep-info]
40 Configure the output that rustc will produce
42 \fB\-\-print\fR [crate-name|file-names|sysroot]
43 Comma separated list of compiler information to print on stdout
46 Equivalent to \fI\-C\fR debuginfo=2
49 Equivalent to \fI\-C\fR opt-level=2
52 Write output to <filename>. Ignored if multiple \fI\-\-emit\fR outputs are
55 \fB\-\-out\-dir\fR DIR
56 Write output to compiler-chosen filename in <dir>. Ignored if \fI\-o\fR is
57 specified. Defaults to the current directory.
60 Provide a detailed explanation of an error message
65 \fB\-\-target\fR TRIPLE
66 Target triple cpu-manufacturer-kernel[-os] to compile for (see chapter 3.4 of
67 http://www.sourceware.org/autobook/ for details)
70 Print 'lint' options and default settings
72 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
75 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
78 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
81 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
84 \fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
85 Set a codegen-related flag to the value specified. Use "-C help" to print
86 available flags. See CODEGEN OPTIONS below
88 \fB\-V\fR, \fB\-\-version\fR
89 Print version info and exit
91 \fB\-v\fR, \fB\-\-verbose\fR
94 \fB\-\-extern\fR NAME=PATH
95 Specify where an external rust library is located
97 \fB\-\-sysroot\fR PATH
98 Override the system root
101 Set internal debugging options. Use "-Z help" to print available options.
103 \fB\-\-color\fR auto|always|never
104 Configure coloring of output:
105 auto = colorize, if output goes to a tty (default);
106 always = always colorize output;
107 never = never colorize output
113 Path to the archive utility to use when assembling archives.
115 \fBlinker\fR=/path/to/cc
116 Path to the linker utility to use when linking libraries, executables, and
119 \fBlink-args\fR='-flag1 -flag2'
120 A space-separated list of extra arguments to pass to the linker when the linker
124 Perform LLVM link-time optimizations.
126 \fBtarget-cpu\fR=help
127 Selects a target processor. If the value is 'help', then a list of available
130 \fBtarget-feature\fR='+feature1,-feature2'
131 A comma-separated list of features to enable or disable for the target. A
132 preceding '+' enables a feature while a preceding '-' disables it. Available
133 features can be discovered through target-cpu=help.
136 A space-separated list of extra LLVM passes to run. A value of 'list' will
137 cause rustc to print all known passes and exit. The passes specified are
138 appended at the end of the normal pass manager.
140 \fBllvm-args\fR='-arg1 -arg2'
141 A space-separated list of arguments to pass through to LLVM.
144 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
145 throughout compilation in the output directory.
148 If specified, then the rpath value for dynamic libraries will be set in
149 either dynamic library or executable outputs.
151 \fBno-prepopulate-passes\fR
152 Suppresses pre-population of the LLVM pass manager that is run over the module.
154 \fBno-vectorize-loops\fR
155 Suppresses running the loop vectorization LLVM pass, regardless of optimization
158 \fBno-vectorize-slp\fR
159 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
163 Generates software floating point library calls instead of hardware
167 Prefers dynamic linking to static linking.
169 \fBno-integrated-as\fR
170 Force usage of an external assembler rather than LLVM's integrated one.
173 Disable the use of the redzone.
175 \fBrelocation-model\fR=[pic,static,dynamic-no-pic]
176 The relocation model to use. (Default: pic)
178 \fBcode-model\fR=[small,kernel,medium,large]
179 Choose the code model to use.
182 Metadata to mangle symbol names with.
184 \fBextra-filename\fR=val
185 Extra data to put in each output filename.
187 \fBcodegen-units\fR=val
188 Divide crate into N units to optimize in parallel.
191 Print remarks for these optimization passes (space separated, or "all").
194 Disable checks for stack exhaustion (a memory-safety hazard!).
197 Debug info emission level:
199 1 = line-tables only (for stacktraces and breakpoints);
200 2 = full debug info with variable and type information.
203 Optimize with possible levels 0-3
206 To build an executable from a source file with a main function:
207 $ rustc -o hello hello.rs
209 To build a library from a source file:
210 $ rustc --crate-type=lib hello-lib.rs
212 To build either with a crate (.rs) file:
215 To build an executable with debug info:
216 $ rustc -g -o hello hello.rs
223 See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues.
226 See \fBAUTHORS.txt\fR in the Rust source distribution.
229 This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
230 file in the rust source distribution.