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
25 Link the generated crate(s) to the specified native library NAME. The optional
26 KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.
28 \fB\-\-crate-type\fR [bin|lib|rlib|dylib|staticlib]
29 Comma separated list of types of crates for the compiler to emit
31 \fB\-\-crate-name NAME\fR
32 Specify the name of the crate being built
34 \fB\-\-emit\fR [asm|llvm-bc|llvm-ir|obj|link|dep-info]
35 Configure the output that rustc will produce
37 \fB\-\-print\fR [crate-name|file-names|sysroot]
38 Comma separated list of compiler information to print on stdout
41 Equivalent to \fI\-C\fR debuginfo=2
44 Equivalent to \fI\-C\fR opt-level=2
47 Write output to <filename>. Ignored if multiple \fI\-\-emit\fR outputs are
50 \fB\-\-out\-dir\fR DIR
51 Write output to compiler-chosen filename in <dir>. Ignored if \fI\-o\fR is
52 specified. Defaults to the current directory.
55 Provide a detailed explanation of an error message
60 \fB\-\-target\fR TRIPLE
61 Target triple cpu-manufacturer-kernel[-os] to compile for (see chapter 3.4 of
62 http://www.sourceware.org/autobook/ for details)
65 Print 'lint' options and default settings
67 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
70 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
73 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
76 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
79 \fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
80 Set a codegen-related flag to the value specified. Use "-C help" to print
81 available flags. See CODEGEN OPTIONS below
83 \fB\-V\fR, \fB\-\-version\fR
84 Print version info and exit
86 \fB\-v\fR, \fB\-\-verbose\fR
89 \fB\-\-extern\fR NAME=PATH
90 Specify where an external rust library is located
92 \fB\-\-sysroot\fR PATH
93 Override the system root
96 Set internal debugging options. Use "-Z help" to print available options.
98 \fB\-\-color\fR auto|always|never
99 Configure coloring of output:
100 auto = colorize, if output goes to a tty (default);
101 always = always colorize output;
102 never = never colorize output
108 Path to the archive utility to use when assembling archives.
110 \fBlinker\fR=/path/to/cc
111 Path to the linker utility to use when linking libraries, executables, and
114 \fBlink-args\fR='-flag1 -flag2'
115 A space-separated list of extra arguments to pass to the linker when the linker
119 Perform LLVM link-time optimizations.
121 \fBtarget-cpu\fR=help
122 Selects a target processor. If the value is 'help', then a list of available
125 \fBtarget-feature\fR='+feature1,-feature2'
126 A comma-separated list of features to enable or disable for the target. A
127 preceding '+' enables a feature while a preceding '-' disables it. Available
128 features can be discovered through target-cpu=help.
131 A space-separated list of extra LLVM passes to run. A value of 'list' will
132 cause rustc to print all known passes and exit. The passes specified are
133 appended at the end of the normal pass manager.
135 \fBllvm-args\fR='-arg1 -arg2'
136 A space-separated list of arguments to pass through to LLVM.
139 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
140 throughout compilation in the output directory.
143 If specified, then the rpath value for dynamic libraries will be set in
144 either dynamic library or executable outputs.
146 \fBno-prepopulate-passes\fR
147 Suppresses pre-population of the LLVM pass manager that is run over the module.
149 \fBno-vectorize-loops\fR
150 Suppresses running the loop vectorization LLVM pass, regardless of optimization
153 \fBno-vectorize-slp\fR
154 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
158 Generates software floating point library calls instead of hardware
162 Prefers dynamic linking to static linking.
164 \fBno-integrated-as\fR
165 Force usage of an external assembler rather than LLVM's integrated one.
168 Disable the use of the redzone.
170 \fBrelocation-model\fR=[pic,static,dynamic-no-pic]
171 The relocation model to use. (Default: pic)
173 \fBcode-model\fR=[small,kernel,medium,large]
174 Choose the code model to use.
177 Metadata to mangle symbol names with.
179 \fBextra-filename\fR=val
180 Extra data to put in each output filename.
182 \fBcodegen-units\fR=val
183 Divide crate into N units to optimize in parallel.
186 Print remarks for these optimization passes (space separated, or "all").
189 Disable checks for stack exhaustion (a memory-safety hazard!).
192 Debug info emission level:
194 1 = line-tables only (for stacktraces and breakpoints);
195 2 = full debug info with variable and type information.
198 Optimize with possible levels 0-3
201 To build an executable from a source file with a main function:
202 $ rustc -o hello hello.rs
204 To build a library from a source file:
205 $ rustc --crate-type=lib hello-lib.rs
207 To build either with a crate (.rs) file:
210 To build an executable with debug info:
211 $ rustc -g -o hello hello.rs
218 See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues.
221 See \fBAUTHORS.txt\fR in the Rust source distribution.
224 This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
225 file in the rust source distribution.