]> git.lizzy.rs Git - rust.git/blob - man/rustc.1
Auto merge of #21932 - Jormundir:std-os-errno-type, r=alexcrichton
[rust.git] / man / rustc.1
1 .TH RUSTC "1" "March 2014" "rustc 0.13.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 <\fBhttps://www.rust-lang.org\fR>.
11
12 .SH OPTIONS
13
14 .TP
15 \fB\-h\fR, \fB\-\-help\fR
16 Display the help message
17 .TP
18 \fB\-\-cfg\fR SPEC
19 Configure the compilation environment
20 .TP
21 \fB\-L\fR [KIND=]PATH
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)
28 .TP
29 \fB\-l\fR [KIND=]NAME
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.
32 .TP
33 \fB\-\-crate-type\fR [bin|lib|rlib|dylib|staticlib]
34 Comma separated list of types of crates for the compiler to emit
35 .TP
36 \fB\-\-crate-name NAME\fR
37 Specify the name of the crate being built
38 .TP
39 \fB\-\-emit\fR [asm|llvm-bc|llvm-ir|obj|link|dep-info]
40 Configure the output that rustc will produce
41 .TP
42 \fB\-\-print\fR [crate-name|file-names|sysroot]
43 Comma separated list of compiler information to print on stdout
44 .TP
45 \fB\-g\fR
46 Equivalent to \fI\-C\fR debuginfo=2
47 .TP
48 \fB\-O\fR
49 Equivalent to \fI\-C\fR opt-level=2
50 .TP
51 \fB\-o\fR FILENAME
52 Write output to <filename>. Ignored if multiple \fI\-\-emit\fR outputs are
53 specified.
54 .TP
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.
58 .TP
59 \fB\-\-explain\fR OPT
60 Provide a detailed explanation of an error message
61 .TP
62 \fB\-\-test\fR
63 Build a test harness
64 .TP
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)
68 .TP
69 \fB\-W\fR help
70 Print 'lint' options and default settings
71 .TP
72 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
73 Set lint warnings
74 .TP
75 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
76 Set lint allowed
77 .TP
78 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
79 Set lint denied
80 .TP
81 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
82 Set lint forbidden
83 .TP
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
87 .TP
88 \fB\-V\fR, \fB\-\-version\fR
89 Print version info and exit
90 .TP
91 \fB\-v\fR, \fB\-\-verbose\fR
92 Use verbose output
93 .TP
94 \fB\-\-extern\fR NAME=PATH
95 Specify where an external rust library is located
96 .TP
97 \fB\-\-sysroot\fR PATH
98 Override the system root
99 .TP
100 \fB\-Z\fR FLAG
101 Set internal debugging options. Use "-Z help" to print available options.
102 .TP
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
108
109 .SH CODEGEN OPTIONS
110
111 .TP
112 \fBar\fR=/path/to/ar
113 Path to the archive utility to use when assembling archives.
114 .TP
115 \fBlinker\fR=/path/to/cc
116 Path to the linker utility to use when linking libraries, executables, and
117 objects.
118 .TP
119 \fBlink-args\fR='-flag1 -flag2'
120 A space-separated list of extra arguments to pass to the linker when the linker
121 is invoked.
122 .TP
123 \fBlto\fR
124 Perform LLVM link-time optimizations.
125 .TP
126 \fBtarget-cpu\fR=help
127 Selects a target processor. If the value is 'help', then a list of available
128 CPUs is printed.
129 .TP
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.
134 .TP
135 \fBpasses\fR=list
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.
139 .TP
140 \fBllvm-args\fR='-arg1 -arg2'
141 A space-separated list of arguments to pass through to LLVM.
142 .TP
143 \fBsave-temps\fR
144 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
145 throughout compilation in the output directory.
146 .TP
147 \fBrpath\fR
148 If specified, then the rpath value for dynamic libraries will be set in
149 either dynamic library or executable outputs.
150 .TP
151 \fBno-prepopulate-passes\fR
152 Suppresses pre-population of the LLVM pass manager that is run over the module.
153 .TP
154 \fBno-vectorize-loops\fR
155 Suppresses running the loop vectorization LLVM pass, regardless of optimization
156 level.
157 .TP
158 \fBno-vectorize-slp\fR
159 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
160 level.
161 .TP
162 \fBsoft-float\fR
163 Generates software floating point library calls instead of hardware
164 instructions.
165 .TP
166 \fBprefer-dynamic\fR
167 Prefers dynamic linking to static linking.
168 .TP
169 \fBno-integrated-as\fR
170 Force usage of an external assembler rather than LLVM's integrated one.
171 .TP
172 \fBno-redzone\fR
173 Disable the use of the redzone.
174 .TP
175 \fBrelocation-model\fR=[pic,static,dynamic-no-pic]
176 The relocation model to use. (Default: pic)
177 .TP
178 \fBcode-model\fR=[small,kernel,medium,large]
179 Choose the code model to use.
180 .TP
181 \fBmetadata\fR=val
182 Metadata to mangle symbol names with.
183 .TP
184 \fBextra-filename\fR=val
185 Extra data to put in each output filename.
186 .TP
187 \fBcodegen-units\fR=val
188 Divide crate into N units to optimize in parallel.
189 .TP
190 \fBremark\fR=val
191 Print remarks for these optimization passes (space separated, or "all").
192 .TP
193 \fBno-stack-check\fR
194 Disable checks for stack exhaustion (a memory-safety hazard!).
195 .TP
196 \fBdebuginfo\fR=val
197 Debug info emission level:
198     0 = no debug info;
199     1 = line-tables only (for stacktraces and breakpoints);
200     2 = full debug info with variable and type information.
201 .TP
202 \fBopt-level\fR=val
203 Optimize with possible levels 0-3
204
205 .SH "EXAMPLES"
206 To build an executable from a source file with a main function:
207     $ rustc -o hello hello.rs
208
209 To build a library from a source file:
210     $ rustc --crate-type=lib hello-lib.rs
211
212 To build either with a crate (.rs) file:
213     $ rustc hello.rs
214
215 To build an executable with debug info:
216     $ rustc -g -o hello hello.rs
217
218 .SH "SEE ALSO"
219
220 rustdoc
221
222 .SH "BUGS"
223 See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues.
224
225 .SH "AUTHOR"
226 See \fBAUTHORS.txt\fR in the Rust source distribution.
227
228 .SH "COPYRIGHT"
229 This work is dual-licensed under Apache 2.0 and MIT terms.  See \fBCOPYRIGHT\fR
230 file in the rust source distribution.