]> git.lizzy.rs Git - rust.git/blob - man/rustc.1
auto merge of #11265 : c-a/rust/byteswap_from, r=alexcrichton
[rust.git] / man / rustc.1
1 .TH RUSTC "1" "July 2013" "rustc 0.7" "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\-\-bin\fR
16 Compile an executable crate (default)
17 .TP
18 \fB\-c\fR
19 Compile and assemble, but do not link
20 .TP
21 \fB\-\-cfg\fR SPEC
22 Configure the compilation environment
23 .TP
24 \fB\-\-emit\-llvm\fR
25 Produce an LLVM bitcode file
26 .TP
27 \fB\-h\fR, \fB\-\-help\fR
28 Display this message
29 .TP
30 \fB\-L\fR PATH
31 Add a directory to the library search path
32 .TP
33 \fB\-\-lib\fR
34 Compile a library crate
35 .TP
36 \fB\-\-linker\fR LINKER
37 Program to use for linking instead of the default
38 .TP
39 \fB\-\-link-args\fR FLAGS
40 A space-separated list of flags passed to the linker
41 .TP
42 \fB\-\-ls\fR
43 List the symbols defined by a library crate
44 .TP
45 \fB\-\-no\-trans\fR
46 Run all passes except translation; no output
47 .TP
48 \fB\-O\fR
49 Equivalent to \fI\-\-opt\-level=2\fR
50 .TP
51 \fB\-o\fR FILENAME
52 Write output to <filename>
53 .TP
54 \fB\-\-opt\-level\fR LEVEL
55 Optimize with possible levels 0-3
56 .TP
57 \fB\-\-passes\fR NAMES
58 Comma- or space-separated list of optimization passes. Overrides
59 the default passes for the optimization level. A value of 'list'
60 will list the available passes.
61 .TP
62 \fB\-\-out\-dir\fR DIR
63 Write output to compiler-chosen filename in <dir>
64 .TP
65 \fB\-\-parse\-only\fR
66 Parse only; do not compile, assemble, or link
67 .TP
68 \fB\-\-pretty\fR [TYPE]
69 Pretty-print the input instead of compiling; valid types are: normal
70 (un-annotated source), expanded (crates expanded), typed (crates
71 expanded, with type annotations), or identified (fully parenthesized,
72 AST nodes and blocks with IDs)
73 .TP
74 \fB\-S\fR
75 Compile only; do not assemble or link
76 .TP
77 \fB\-\-save\-temps\fR
78 Write intermediate files (.bc, .opt.bc, .o) in addition to normal output
79 .TP
80 \fB\-\-sysroot\fR PATH
81 Override the system root
82 .TP
83 \fB\-\-test\fR
84 Build a test harness
85 .TP
86 \fB\-\-target\fR TRIPLE
87 Target triple cpu-manufacturer-kernel[-os] to compile for (see
88 http://sources.redhat.com/autobook/autobook/autobook_17.html
89 for details)
90 .TP
91 \fB\-\-target-feature\fR TRIPLE
92 Target-specific attributes (see llc -mattr=help for details)
93 .TP
94 \fB\-\-android-cross-path\fR PATH
95 The path to the Android NDK
96 .TP
97 \fB\-W\fR help
98 Print 'lint' options and default settings
99 .TP
100 \fB\-W\fR OPT, \fB\-\-warn\fR OPT
101 Set lint warnings
102 .TP
103 \fB\-A\fR OPT, \fB\-\-allow\fR OPT
104 Set lint allowed
105 .TP
106 \fB\-D\fR OPT, \fB\-\-deny\fR OPT
107 Set lint denied
108 .TP
109 \fB\-F\fR OPT, \fB\-\-forbid\fR OPT
110 Set lint forbidden
111 .TP
112 \fB\-Z\fR FLAG
113 Set internal debugging options. Use "-Z help" to print available options.
114 .TP
115 \fB\-v\fR, \fB\-\-version\fR
116 Print version info and exit
117
118 .SH "EXAMPLES"
119 To build an executable from a source file with a main function:
120     $ rustc -o hello hello.rs
121
122 To build a library from a source file:
123     $ rustc --lib hello-lib.rs
124
125 To build either with a crate (.rc) file:
126     $ rustc hello.rc
127
128 To build an executable with debug info (experimental):
129     $ rustc -Z debug-info -o hello hello.rs
130
131 .SH "SEE ALSO"
132
133 rustdoc, rustpkg
134
135 .SH "BUGS"
136 See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
137
138 .SH "AUTHOR"
139 See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
140 <\fIgraydon@mozilla.com\fR> is the project leader.
141
142 .SH "COPYRIGHT"
143 This work is dual-licensed under Apache 2.0 and MIT terms.  See \fBCOPYRIGHT\fR
144 file in the rust source distribution.