]> git.proxmox.com Git - rustc.git/blob - man/rustc.1
Imported Upstream version 1.1.0+dfsg1
[rustc.git] / man / rustc.1
1 .TH RUSTC "1" "June 2015" "rustc 1.1.0" "User Commands"
2 .SH NAME
3 rustc \- The Rust compiler
4 .SH SYNOPSIS
5 .B rustc
6 [\fIOPTIONS\fR] \fIINPUT\fR
7
8 .SH DESCRIPTION
9 This program is a compiler for the Rust language, available at
10 .UR https://www.rust\-lang.org
11 .UE .
12
13 .SH OPTIONS
14
15 .TP
16 \fB\-h\fR, \fB\-\-help\fR
17 Display the help message.
18 .TP
19 \fB\-\-cfg\fR \fISPEC\fR
20 Configure the compilation environment.
21 .TP
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:
25 .RS
26 .TP
27 \fBdependency\fR
28 only lookup transitive dependencies here
29 .TP
30 .B crate
31 only lookup local `extern crate` directives here
32 .TP
33 .B native
34 only lookup native libraries here
35 .TP
36 .B framework
37 only look for OSX frameworks here
38 .TP
39 .B all
40 look for anything here (the default)
41 .RE
42 .TP
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
46 \fIframework\fR.
47 If omitted, \fIdylib\fR is assumed.
48 .TP
49 \fB\-\-crate\-type\fR [bin|lib|rlib|dylib|staticlib]
50 Comma separated list of types of crates for the compiler to emit.
51 .TP
52 \fB\-\-crate\-name\fR \fINAME\fR
53 Specify the name of the crate being built.
54 .TP
55 \fB\-\-emit\fR [asm|llvm\-bc|llvm\-ir|obj|link|dep\-info]
56 Configure the output that \fBrustc\fR will produce.
57 .TP
58 \fB\-\-print\fR [crate\-name|file\-names|sysroot]
59 Comma separated list of compiler information to print on stdout.
60 .TP
61 \fB\-g\fR
62 Equivalent to \fI\-C\ debuginfo=2\fR.
63 .TP
64 \fB\-O\fR
65 Equivalent to \fI\-C\ opt\-level=2\fR.
66 .TP
67 \fB\-o\fR \fIFILENAME\fR
68 Write output to \fIFILENAME\fR.
69 Ignored if multiple \fI\-\-emit\fR outputs are specified.
70 .TP
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.
75 .TP
76 \fB\-\-explain\fR \fIOPT\fR
77 Provide a detailed explanation of an error message.
78 .TP
79 \fB\-\-test\fR
80 Build a test harness.
81 .TP
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/
86 .UE
87 for details).
88 .TP
89 \fB\-W help\fR
90 Print 'lint' options and default settings.
91 .TP
92 \fB\-W\fR \fIOPT\fR, \fB\-\-warn\fR \fIOPT\fR
93 Set lint warnings.
94 .TP
95 \fB\-A\fR \fIOPT\fR, \fB\-\-allow\fR \fIOPT\fR
96 Set lint allowed.
97 .TP
98 \fB\-D\fR \fIOPT\fR, \fB\-\-deny\fR \fIOPT\fR
99 Set lint denied.
100 .TP
101 \fB\-F\fR \fIOPT\fR, \fB\-\-forbid\fR \fIOPT\fR
102 Set lint forbidden.
103 .TP
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.
108 .TP
109 \fB\-V\fR, \fB\-\-version\fR
110 Print version info and exit.
111 .TP
112 \fB\-v\fR, \fB\-\-verbose\fR
113 Use verbose output.
114 .TP
115 \fB\-\-extern\fR \fINAME\fR=\fIPATH\fR
116 Specify where an external rust library is located.
117 .TP
118 \fB\-\-sysroot\fR \fIPATH\fR
119 Override the system root.
120 .TP
121 \fB\-Z\fR \fIFLAG\fR
122 Set internal debugging options.
123 Use \fI\-Z help\fR to print available options.
124 .TP
125 \fB\-\-color\fR auto|always|never
126 Configure coloring of output:
127 .RS
128 .TP
129 .B auto
130 colorize, if output goes to a tty (default);
131 .TP
132 .B always
133 always colorize output;
134 .TP
135 .B never
136 never colorize output.
137 .RE
138
139 .SH CODEGEN OPTIONS
140
141 .TP
142 \fBar\fR=\fI/path/to/ar\fR
143 Path to the archive utility to use when assembling archives.
144 .TP
145 \fBlinker\fR=\fI/path/to/cc\fR
146 Path to the linker utility to use when linking libraries, executables, and
147 objects.
148 .TP
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
151 is invoked.
152 .TP
153 \fBlto\fR
154 Perform LLVM link\[hy]time optimizations.
155 .TP
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.
159 .TP
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 \fIllc -mcpu=help\fR.
164 .TP
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
168 exit.
169 The passes specified are appended at the end of the normal pass manager.
170 .TP
171 \fBllvm\-args\fR='\fI\-arg1\fR \fI\-arg2\fR'
172 A space\[hy]separated list of arguments to pass through to LLVM.
173 .TP
174 \fBsave\-temps\fR
175 If specified, the compiler will save more files (.bc, .o, .no\-opt.bc) generated
176 throughout compilation in the output directory.
177 .TP
178 \fBrpath\fR
179 If specified, then the rpath value for dynamic libraries will be set in
180 either dynamic library or executable outputs.
181 .TP
182 \fBno\-prepopulate\-passes\fR
183 Suppresses pre\[hy]population of the LLVM pass manager that is run over the module.
184 .TP
185 \fBno\-vectorize\-loops\fR
186 Suppresses running the loop vectorization LLVM pass, regardless of optimization
187 level.
188 .TP
189 \fBno\-vectorize\-slp\fR
190 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
191 level.
192 .TP
193 \fBsoft\-float\fR
194 Generates software floating point library calls instead of hardware
195 instructions.
196 .TP
197 \fBprefer\-dynamic\fR
198 Prefers dynamic linking to static linking.
199 .TP
200 \fBno\-integrated\-as\fR
201 Force usage of an external assembler rather than LLVM's integrated one.
202 .TP
203 \fBno\-redzone\fR
204 Disable the use of the redzone.
205 .TP
206 \fBrelocation\-model\fR=[pic,static,dynamic\-no\-pic]
207 The relocation model to use.
208 (Default: \fIpic\fR)
209 .TP
210 \fBcode\-model\fR=[small,kernel,medium,large]
211 Choose the code model to use.
212 .TP
213 \fBmetadata\fR=\fIval\fR
214 Metadata to mangle symbol names with.
215 .TP
216 \fBextra\-filename\fR=\fIval\fR
217 Extra data to put in each output filename.
218 .TP
219 \fBcodegen\-units\fR=\fIn\fR
220 Divide crate into \fIn\fR units to optimize in parallel.
221 .TP
222 \fBremark\fR=\fIval\fR
223 Print remarks for these optimization passes (space separated, or "all").
224 .TP
225 \fBno\-stack\-check\fR
226 Disable checks for stack exhaustion (a memory\[hy]safety hazard!).
227 .TP
228 \fBdebuginfo\fR=\fIval\fR
229 Debug info emission level:
230 .RS
231 .TP
232 .B 0
233 no debug info;
234 .TP
235 .B 1
236 line\[hy]tables only (for stacktraces and breakpoints);
237 .TP
238 .B 2
239 full debug info with variable and type information.
240 .RE
241 .TP
242 \fBopt\-level\fR=\fIVAL\fR
243 Optimize with possible levels 0\[en]3
244
245 .SH ENVIRONMENT
246
247 Some of these affect the output of the compiler, while others affect programs
248 which link to the standard library.
249
250 .TP
251 \fBRUST_TEST_THREADS\fR
252 The test framework Rust provides executes tests in parallel. This variable sets
253 the maximum number of threads used for this purpose.
254
255 .TP
256 \fBRUST_TEST_NOCAPTURE\fR
257 A synonym for the --nocapture flag.
258
259 .TP
260 \fBRUST_MIN_STACK\fR
261 Sets the minimum stack size for new threads.
262
263 .TP
264 \fBRUST_BACKTRACE\fR
265 If set, produces a backtrace in the output of a program which panics.
266
267 .SH "EXAMPLES"
268 To build an executable from a source file with a main function:
269 $ rustc \-o hello hello.rs
270
271 To build a library from a source file:
272 $ rustc \-\-crate\-type=lib hello\-lib.rs
273
274 To build either with a crate (.rs) file:
275 $ rustc hello.rs
276
277 To build an executable with debug info:
278 $ rustc \-g \-o hello hello.rs
279
280 .SH "SEE ALSO"
281
282 .BR rustdoc (1)
283
284 .SH "BUGS"
285 See
286 .UR https://github.com/rust\-lang/rust/issues
287 .UE
288 for issues.
289
290 .SH "AUTHOR"
291 See \fIAUTHORS.txt\fR in the Rust source distribution.
292
293 .SH "COPYRIGHT"
294 This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
295 See \fICOPYRIGHT\fR file in the rust source distribution.