|
1 |
| -.TH RUSTC "1" "October 2011" "Rust" "User Commands" |
| 1 | +.TH RUSTC "1" "January 2012" "Rust" "User Commands" |
| 2 | + |
2 | 3 | .SH NAME
|
3 | 4 | rustc \- rust compiler
|
| 5 | + |
4 | 6 | .SH SYNOPSIS
|
5 | 7 | rustc [\fB-h\fR] [\fB-v\fR] [\fB-o\fR \fIoutfile\fR]
|
6 | 8 | [\fB--lib\fR] [\fB--static\fR] [\fB-L\fR \fIpath\fR]
|
7 | 9 | [\fB-g\fR] [\fB-S\fR] [\fB-c\fR] <\fIinput\fR>
|
8 | 10 | .PP
|
9 | 11 | Only the most commonly-used options are listed here. All options are listed and
|
10 | 12 | described below.
|
| 13 | + |
11 | 14 | .SH DESCRIPTION
|
12 | 15 | This program is a compiler for the Rust language, available at
|
13 | 16 | <\fBhttps://www.rust-lang.org\fR>.
|
| 17 | + |
14 | 18 | .SH OPTIONS
|
15 | 19 | .TP
|
16 |
| -\fB-h, --help\fR: |
17 |
| -Display help. |
| 20 | +\fB--bin\fR |
| 21 | +Compile an executable crate (default) |
18 | 22 | .TP
|
19 |
| -\fB-v, --version\fR: |
20 |
| -Display version information. |
| 23 | +\fB-c\fR |
| 24 | +Compile and assemble, but do not link |
21 | 25 | .TP
|
22 |
| -\fB-o\fR \fIfilename\fR: |
23 |
| -Write output to \fIfilename\fR. The default |
24 |
| -output filename for \fBfoo.rs\fR is otherwise \fBfoo\fR plus any |
25 |
| -platform-specific extension (when compiling a binary), a |
26 |
| -platform-specific name, e.g. \fBlibfoo.so\fR (when compiling a |
27 |
| -library), \fBfoo.o\fR (when using \fB-c\fR), \fBfoo.s\fR (when using |
28 |
| -\fB-S\fR) or \fBfoo.bc\fR (when using \fB--emit-llvm\fR), and \fBfoo.ll\fR |
29 |
| -(when using both \fB-S\fR and \fB--emit-llvm\fR). |
| 26 | +\fB--cfg <cfgspec>\fR |
| 27 | +Configure the compilation environment |
30 | 28 | .TP
|
31 |
| -\fB--lib\fR: |
32 |
| -Compile and link a library crate into a shared object. |
| 29 | +\fB--emit-llvm\fR |
| 30 | +Produce an LLVM bitcode file |
33 | 31 | .TP
|
34 |
| -\fB--static\fR: |
35 |
| -Produce a statically-linked binary, or generate a static |
36 |
| -library. |
| 32 | +\fB-g\fR |
| 33 | +Produce debug info |
37 | 34 | .TP
|
38 |
| -\fB--pretty\fR \fI[type]\fR: |
39 |
| -Pretty-print the input. Valid \fItype\fRs are: |
40 |
| -.RS |
| 35 | +\fB--gc\fR |
| 36 | +Garbage collect shared data (experimental/temporary) |
41 | 37 | .TP
|
42 |
| -\fBnormal\fR: Un-annotated source (default). |
| 38 | +\fB-h --help\fR |
| 39 | +Display this message |
43 | 40 | .TP
|
44 |
| -\fBexpanded\fR: Crates expanded. |
| 41 | +\fB-L <path>\fR |
| 42 | +Add a directory to the library search path |
45 | 43 | .TP
|
46 |
| -\fBtyped\fR: Crates expanded, all expressions annotated with types. |
| 44 | +\fB--lib\fR |
| 45 | +Compile a library crate |
47 | 46 | .TP
|
48 |
| -\fBidentified\fR: Fully parenthesized, ast nodes and blocks annotated with IDs. |
49 |
| -.RE |
| 47 | +\fB--ls\fR |
| 48 | +List the symbols defined by a compiled librar crate |
50 | 49 | .TP
|
51 |
| -\fB--ls\fR: |
52 |
| -Lists symbols defined by the specified \fBcompiled\fR library. |
| 50 | +\fB--no-asm-comments\fR |
| 51 | +Do not add comments into the assembly source |
53 | 52 | .TP
|
54 |
| -\fB-L\fR \fIpath\fR: |
55 |
| -Adds \fIpath\fR to the library search path. |
| 53 | +\fB--no-lint-ctypes\fR |
| 54 | +Suppress warnings for possibly incorrect ctype usage |
56 | 55 | .TP
|
57 |
| -\fB--noverify\fR: |
58 |
| -Disables LLVM verification pass, which does sanity checking of |
59 |
| -bitcode generated by rustc. Using this option gives a slight speedup, at the |
60 |
| -cost of vastly reduced ability to catch rustc bugs. See |
61 |
| -<\fBhttp://llvm.org/docs/Passes.html\fR> for a list of properties checked. |
| 56 | +\fB--no-trans\fR |
| 57 | +Run all passes except translation; no output |
62 | 58 | .TP
|
63 |
| -\fB--parse-only\fR: |
64 |
| -Run the parse phase only. If parsing succeeds, produces no |
65 |
| -output. |
| 59 | +\fB--no-verify\fR |
| 60 | +Suppress LLVM verification step (slight speedup) |
| 61 | +(see http://llvm.org/docs/Passes.html for detail) |
66 | 62 | .TP
|
67 |
| -\fB--no-trans\fR: |
68 |
| -Run all passes except translation. Produces no output. |
| 63 | +\fB-O\fR |
| 64 | +Equivalent to --opt-level=2 |
69 | 65 | .TP
|
70 |
| -\fB-g\fR: |
71 |
| -Produce debug info. |
| 66 | +\fB-o <filename>\fR |
| 67 | +Write output to <filename> |
72 | 68 | .TP
|
73 |
| -\fB--opt-level\fR \fIlevel\fR: |
74 |
| -Set optimization level to \fIlevel\fR. |
| 69 | +\fB--opt-level <lvl>\fR |
| 70 | +Optimize with possible levels 0-3 |
75 | 71 | .TP
|
76 |
| -\fB-O\fR: |
77 |
| -Equal to --opt-level=2 |
| 72 | +\fB--out-dir <dir>\fR |
| 73 | +Write output to compiler-chosen filename in <dir> |
78 | 74 | .TP
|
79 |
| -\fB-S\fR: |
80 |
| -Compile to assembly, but do not assemble or link. |
| 75 | +\fB--parse-only\fR |
| 76 | +Parse only; do not compile, assemble, or link |
81 | 77 | .TP
|
82 |
| -\fB-c\fR: |
83 |
| -Compile and assemble, but do not link. |
| 78 | +\fB--pretty [type]\fR |
| 79 | +Pretty-print the input instead of compiling; valid types are: \fBnormal\fR (un-annotated source), \fBexpanded\fR (crates expanded), \fBtyped\fR (crates expanded, with type annotations), or \fBidentified\fR (fully parenthesized, AST nodes and blocks with IDs) |
84 | 80 | .TP
|
85 |
| -\fB--emit-llvm\fR: |
86 |
| -Generate output files in LLVM format. When used with \fB-S\fR this generate LLVM |
87 |
| -intermediate language assembly files, otherwise this generates LLVM bitcode |
88 |
| -format object files. |
| 81 | +\fB-S\fR |
| 82 | +Compile only; do not assemble or link |
89 | 83 | .TP
|
90 |
| -\fB--save-temps\fR: |
91 |
| -For foo.rs, save generated bitcode before optimization to |
92 |
| -\fBfoo.bc\fR, bitcode after optimization to \fBfoo.opt.bc\fR, and the generated |
93 |
| -object file to \fBfoo.o\fR. |
| 84 | +\fB--save-temps\fR |
| 85 | +Write intermediate files (.bc, .opt.bc, .o) in addition to normal output |
94 | 86 | .TP
|
95 |
| -\fB--stats\fR: |
96 |
| -Print statistics about compilation. |
| 87 | +\fB--static\fR |
| 88 | +Use or produce static libraries or binaries |
97 | 89 | .TP
|
98 |
| -\fB--cfg\fR \fIcfgspec\fR: |
99 |
| -Provide a crate config spec. |
| 90 | +\fB--stats\fR |
| 91 | +Print compilation statistics |
100 | 92 | .TP
|
101 |
| -\fB--time-passes\fR: |
102 |
| -Print runtimes of compilation phases. |
| 93 | +\fB--sysroot <path>\fR |
| 94 | +Override the system root |
103 | 95 | .TP
|
104 |
| -\fB--time-llvm-passes\fR: |
105 |
| -Print runtimes of llvm phases. |
| 96 | +\fB--test\fR |
| 97 | +Build test harness |
106 | 98 | .TP
|
107 |
| -\fB--sysroot\fR \fIpath\fR: |
108 |
| -Set the system root. Default is the directory above |
109 |
| -rustc's. |
| 99 | +\fB--target <triple>\fR |
| 100 | +Target cpu-manufacturer-kernel[-os] to compile for (default: host triple) |
| 101 | +(see http://sources.redhat.com/autobook/autobook/autobook_17.html for detail) |
110 | 102 | .TP
|
111 |
| -\fB--target\fR \fIgnu-config-name\fR: |
112 |
| -Set the compilation target, which is a |
113 |
| -string of the form \fBcpu\fR-\fBmanufacturer\fR-\fBkernel\fR[-\fBos\fR]. Example |
114 |
| -values include "i686-unknown-linux-gnu" and "mips-idt-ecoff"; see |
115 |
| -<\fBhttp://sources.redhat.com/autobook/autobook/autobook_17.html\fR>. If not |
116 |
| -supplied, the host triple is used (see \fB--version\fR output). |
| 103 | +\fB--time-passes\fR |
| 104 | +Time the individual phases of the compiler |
117 | 105 | .TP
|
118 |
| -\fB--test\fR: |
119 |
| -Build a test harness. |
| 106 | +\fB--time-llvm-passes\fR |
| 107 | +Time the individual phases of the LLVM backend |
120 | 108 | .TP
|
121 |
| -\fB--gc\fR: |
122 |
| -\fBEXPERIMENTAL\fR. Garbage-collect shared data. |
| 109 | +\fB-v --version\fR |
| 110 | +Print version info and exit |
123 | 111 | .TP
|
124 |
| -\fB--warn-unused-imports\fR: |
125 |
| -Warn about unnecessary imports. |
126 |
| -.TP |
127 |
| -\fB--no-lint-ctypes\fR: |
128 |
| -Disables checking of possibly incorrect usage of Rust int or uint types in |
129 |
| -native function declarations, where types defined in libcore::ctypes should be |
130 |
| -used instead. Ctypes check emits warnings by default. |
| 112 | +\fB--warn-unused-imports\fR |
| 113 | +Warn about unnecessary imports |
| 114 | + |
| 115 | +.SH "EXAMPLES" |
| 116 | +To build an executable from a source file with a main function: |
| 117 | + $ rustc -o hello hello.rs |
| 118 | + |
| 119 | +To build a library from a source file: |
| 120 | + $ rustc --lib hello-lib.rs |
| 121 | + |
| 122 | +To build either with a crate (.rc) file: |
| 123 | + $ rustc hello.rc |
| 124 | + |
131 | 125 | .SH "BUGS"
|
132 | 126 | See \fBhttps://github.com/mozilla/rust/issues\fR for a list of known bugs.
|
| 127 | + |
133 | 128 | .SH "AUTHOR"
|
134 | 129 | See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
|
135 | 130 | < \fI[email protected]\fR> is the project leader.
|
| 131 | + |
136 | 132 | .SH "COPYRIGHT"
|
137 | 133 | See \fBLICENSE.txt\fR in the rust source distribution.
|
| 134 | + |
0 commit comments