]> git.lizzy.rs Git - rust.git/blob - man/rustc.1
Add rustc --pretty flowgraph to man page
[rust.git] / man / rustc.1
1 .TH RUSTC "1" "March 2014" "rustc 0.11.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\-\-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\-\-no\-trans\fR
31 Run all passes except translation; no output
32 .TP
33 \fB\-\-no\-analysis\fR
34 Parse and expand the source, but run no analysis and produce no output
35 .TP
36 \fB\-g\fR
37 Emit DWARF debug information into object files generated.
38 .TP
39 \fB\-\-debuginfo\fR LEVEL
40 Emit DWARF debug info to the objects created: 0 = no debug info, 1 =
41 line-tables only (for stacktraces and breakpoints), 2 = full debug
42 info with variable and type information (same as -g).
43 .TP
44 \fB\-O\fR
45 Equivalent to \fI\-\-opt\-level=2\fR
46 .TP
47 \fB\-o\fR FILENAME
48 Write output to <filename>. Ignored if more than one --emit is specified.
49 .TP
50 \fB\-\-opt\-level\fR LEVEL
51 Optimize with possible levels 0-3
52 .TP
53 \fB\-\-out\-dir\fR DIR
54 Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
55 (default the current directory)
56 .TP
57 \fB\-\-parse\-only\fR
58 Parse only; do not compile, assemble, or link
59 .TP
60 \fB\-\-pretty\fR [TYPE]
61 Pretty-print the input instead of compiling; valid types are: normal
62 (un-annotated source), expanded (crates expanded), typed (crates
63 expanded, with type annotations), identified (fully parenthesized,
64 AST nodes and blocks with IDs), or flowgraph=<nodeid> (graphviz
65 formatted flowgraph for node)
66 .TP
67 \fB\-\-dep-info\fR [FILENAME]
68 Output dependency info to <filename> after compiling, in o format suitable
69 for use by Makefiles.
70 .TP
71 \fB\-\-sysroot\fR PATH
72 Override the system root
73 .TP
74 \fB\-\-test\fR
75 Build a test harness
76 .TP
77 \fB\-\-target\fR TRIPLE
78 Target triple cpu-manufacturer-kernel[-os] to compile for (see
79 http://sources.redhat.com/autobook/autobook/autobook_17.html
80 for details)
81 .TP
82 \fB\-W\fR help
83 Print 'lint' options and default settings
84 .TP
85 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
86 Set lint warnings
87 .TP
88 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
89 Set lint allowed
90 .TP
91 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
92 Set lint denied
93 .TP
94 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
95 Set lint forbidden
96 .TP
97 \fB\-Z\fR FLAG
98 Set internal debugging options. Use "-Z help" to print available options.
99 .TP
100 \fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
101 Set a codegen-related flag to the value specified. Use "-C help" to print
102 available flags. See CODEGEN OPTIONS below
103 .TP
104 \fB\-v\fR, \fB\-\-version\fR
105 Print version info and exit
106
107 .SH CODEGEN OPTIONS
108
109 .TP
110 \fBar\fR=/path/to/ar
111 Path to the archive utility to use when assembling archives.
112 .TP
113 \fBlinker\fR=/path/to/cc
114 Path to the linker utility to use when linking libraries, executables, and
115 objects.
116 .TP
117 \fBlink-args\fR='-flag1 -flag2'
118 A space-separated list of extra arguments to pass to the linker when the linker
119 is invoked.
120 .TP
121 \fBtarget-cpu\fR=help
122 Selects a target processor. If the value is 'help', then a list of available
123 CPUs is printed.
124 .TP
125 \fBtarget-feature\fR='+feature1 -feature2'
126 A space-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.
129 .TP
130 \fBpasses\fR=list
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.
134 .TP
135 \fBllvm-args\fR='-arg1 -arg2'
136 A space-separated list of arguments to pass through to LLVM.
137 .TP
138 \fBsave-temps\fR
139 If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
140 throughout compilation in the output directory.
141 .TP
142 \fBrpath\fR
143 If specified, then the rpath value for dynamic libraries will be set in
144 either dynamic library or executable outputs.
145 .TP
146 \fBno-prepopulate-passes\fR
147 Suppresses pre-population of the LLVM pass manager that is run over the module.
148 .TP
149 \fBno-vectorize-loops\fR
150 Suppresses running the loop vectorization LLVM pass, regardless of optimization
151 level.
152 .TP
153 \fBno-vectorize-slp\fR
154 Suppresses running the LLVM SLP vectorization pass, regardless of optimization
155 level.
156 .TP
157 \fBsoft-float\fR
158 Generates software floating point library calls instead of hardware
159 instructions.
160 .TP
161 \fBprefer-dynamic\fR
162 Prefers dynamic linking to static linking.
163 .TP
164 \fBno-integrated-as\fR
165 Force usage of an external assembler rather than LLVM's integrated one.
166 .TP
167 \fBrelocation-model\fR=[pic,static,dynamic-no-pic]
168 The relocation model to use. (default: pic)
169
170 .SH "EXAMPLES"
171 To build an executable from a source file with a main function:
172     $ rustc -o hello hello.rs
173
174 To build a library from a source file:
175     $ rustc --crate-type=lib hello-lib.rs
176
177 To build either with a crate (.rs) file:
178     $ rustc hello.rs
179
180 To build an executable with debug info:
181     $ rustc -g -o hello hello.rs
182
183 .SH "SEE ALSO"
184
185 rustdoc
186
187 .SH "BUGS"
188 See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues.
189
190 .SH "AUTHOR"
191 See \fBAUTHORS.txt\fR in the Rust source distribution.
192
193 .SH "COPYRIGHT"
194 This work is dual-licensed under Apache 2.0 and MIT terms.  See \fBCOPYRIGHT\fR
195 file in the rust source distribution.