]> git.lizzy.rs Git - rust.git/blob - man/rustc.1
b3eb4834930d4af21dfc4de765c43266fe8b9363
[rust.git] / man / rustc.1
1 .TH RUSTC "1" "March 2014" "rustc 0.10-pre" "User Commands"
2 .SH NAME
3 rustc \- 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\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
16 Configure the flavor of rust crate that is generated (default `bin`)
17 .TP
18 \fB\-\-cfg\fR SPEC
19 Configure the compilation environment
20 .TP
21 \fB\-\-emit=[asm,ir,bc,obj,link]\fR
22 Configure the output that rustc will produce
23 .TP
24 \fB\-h\fR, \fB\-\-help\fR
25 Display this message
26 .TP
27 \fB\-L\fR PATH
28 Add a directory to the library search path
29 .TP
30 \fB\-\-ls\fR
31 List the symbols defined by a library crate
32 .TP
33 \fB\-\-no\-trans\fR
34 Run all passes except translation; no output
35 .TP
36 \fB\-g\fR, \fB\-\-debuginfo\fR
37 Emit DWARF debug information into object files generated.
38 .TP
39 \fB\-O\fR
40 Equivalent to \fI\-\-opt\-level=2\fR
41 .TP
42 \fB\-o\fR FILENAME
43 Write output to <filename>. Ignored if more than one --emit is specified.
44 .TP
45 \fB\-\-opt\-level\fR LEVEL
46 Optimize with possible levels 0-3
47 .TP
48 \fB\-\-out\-dir\fR DIR
49 Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
50 (default the current directory)
51 .TP
52 \fB\-\-parse\-only\fR
53 Parse only; do not compile, assemble, or link
54 .TP
55 \fB\-\-pretty\fR [TYPE]
56 Pretty-print the input instead of compiling; valid types are: normal
57 (un-annotated source), expanded (crates expanded), typed (crates
58 expanded, with type annotations), or identified (fully parenthesized,
59 AST nodes and blocks with IDs)
60 .TP
61 \fB\-\-sysroot\fR PATH
62 Override the system root
63 .TP
64 \fB\-\-test\fR
65 Build a test harness
66 .TP
67 \fB\-\-target\fR TRIPLE
68 Target triple cpu-manufacturer-kernel[-os] to compile for (see
69 http://sources.redhat.com/autobook/autobook/autobook_17.html
70 for details)
71 .TP
72 \fB\-W\fR help
73 Print 'lint' options and default settings
74 .TP
75 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
76 Set lint warnings
77 .TP
78 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
79 Set lint allowed
80 .TP
81 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
82 Set lint denied
83 .TP
84 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
85 Set lint forbidden
86 .TP
87 \fB\-Z\fR FLAG
88 Set internal debugging options. Use "-Z help" to print available options.
89 .TP
90 \fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
91 Set a codegen-related flag to the value specifie.d Use "-C help" to print
92 available flags. See CODEGEN OPTIONS below
93 .TP
94 \fB\-v\fR, \fB\-\-version\fR
95 Print version info and exit
96
97 .SH CODEGEN OPTIONS
98
99 .TP
100 \fBar\fR=/path/to/ar
101 Path to the archive utility to use when assembling archives.
102 .TP
103 \fBlinker\fR=/path/to/cc
104 Path to the linker utility to use when linking libraries, executables, and
105 objects.
106 .TP
107 \fBlink-args\fR='-flag1 -flag2'
108 A space-separated list of extra arguments to pass to the linker when the linker
109 is invoked.
110 .TP
111 \fBtarget-cpu\fR=help
112 Selects a target processor. If the value is 'help', then a list of available
113 cpus is printed.
114 .TP
115 \fBtarget-feature\fR='+feature1 -feature2'
116 A space-separated list of features to enable or disable for the target. A
117 preceding '+' enables a feature while a preceding '-' disables it. Available
118 features can be discovered through target-cpu=help.
119 .TP
120 \fBpasses\fR=list
121 A space-separated list of extra LLVM passes to run. A value of 'list' will
122 cause rustc to print all known passes and exit. The passes specified are
123 appended at the end of the normal pass manager.
124 .TP
125 \fBllvm-args\fR='-arg1 -arg2'
126 A space-separted list of argument to pass through to LLVM.
127 .TP
128 \fBsave-temps\fR
129 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
130 throughout compilation in the output directory.
131 .TP
132 \fBandroid-cross-path\fR=path/to/ndk/bin
133 Directory to find the Android NDK cross-compilation tools
134 .TP
135 \fBno-rpath\fR
136 If specified, then the rpath value for dynamic libraries will not be set in
137 either dynamic library or executable outputs.
138 .TP
139 \fBno-prepopulate-passes\fR
140 Suppresses pre-population of the LLVM pass manager that is run over the module.
141 .TP
142 \fBno-vectorize-loops\fR
143 Suppresses running the loop vectorization LLVM pass, regardless of optimization
144 level.
145 .TP
146 \fBno-vectorize-slp\fR
147 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
148 level.
149 .TP
150 \fBsoft-float\fR
151 Generates software floating point library calls instead of hardware
152 instructions.
153 .TP
154 \fBgen-crate-map\fR
155 Forces generate of a toplevel crate map. May be required for logging to work
156 when rust is embedded into another application.
157 .TP
158 \fBprefer-dynamic\fR
159 Prefers dynamic linking to static linking.
160 .TP
161 \fBno-integrated-as\fR
162 Force usage of an external assembler rather than LLVM's integrated one.
163
164 .SH "EXAMPLES"
165 To build an executable from a source file with a main function:
166     $ rustc -o hello hello.rs
167
168 To build a library from a source file:
169     $ rustc --crate-type=lib hello-lib.rs
170
171 To build either with a crate (.rs) file:
172     $ rustc hello.rs
173
174 To build an executable with debug info:
175     $ rustc -g -o hello hello.rs
176
177 .SH "SEE ALSO"
178
179 rustdoc
180
181 .SH "BUGS"
182 See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
183
184 .SH "AUTHOR"
185 See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
186 <\fIgraydon@mozilla.com\fR> is the project leader.
187
188 .SH "COPYRIGHT"
189 This work is dual-licensed under Apache 2.0 and MIT terms.  See \fBCOPYRIGHT\fR
190 file in the rust source distribution.