Merge pull request #1713 from killerswan/manpg

Updating the manpage and usage message
This commit is contained in:
Graydon Hoare 2012-01-31 14:09:48 -08:00
commit 24668d7578
2 changed files with 125 additions and 119 deletions

View file

@ -1,6 +1,8 @@
.TH RUSTC "1" "October 2011" "Rust" "User Commands" .TH RUSTC "1" "January 2012" "Rust" "User Commands"
.SH NAME .SH NAME
rustc \- rust compiler rustc \- rust compiler
.SH SYNOPSIS .SH SYNOPSIS
rustc [\fB-h\fR] [\fB-v\fR] [\fB-o\fR \fIoutfile\fR] rustc [\fB-h\fR] [\fB-v\fR] [\fB-o\fR \fIoutfile\fR]
[\fB--lib\fR] [\fB--static\fR] [\fB-L\fR \fIpath\fR] [\fB--lib\fR] [\fB--static\fR] [\fB-L\fR \fIpath\fR]
@ -8,130 +10,125 @@ rustc [\fB-h\fR] [\fB-v\fR] [\fB-o\fR \fIoutfile\fR]
.PP .PP
Only the most commonly-used options are listed here. All options are listed and Only the most commonly-used options are listed here. All options are listed and
described below. described below.
.SH DESCRIPTION .SH DESCRIPTION
This program is a compiler for the Rust language, available at This program is a compiler for the Rust language, available at
<\fBhttps://www.rust-lang.org\fR>. <\fBhttps://www.rust-lang.org\fR>.
.SH OPTIONS .SH OPTIONS
.TP .TP
\fB-h, --help\fR: \fB--bin\fR
Display help. Compile an executable crate (default)
.TP .TP
\fB-v, --version\fR: \fB-c\fR
Display version information. Compile and assemble, but do not link
.TP .TP
\fB-o\fR \fIfilename\fR: \fB--cfg <cfgspec>\fR
Write output to \fIfilename\fR. The default Configure the compilation environment
output filename for \fBfoo.rs\fR is otherwise \fBfoo\fR plus any
platform-specific extension (when compiling a binary), a
platform-specific name, e.g. \fBlibfoo.so\fR (when compiling a
library), \fBfoo.o\fR (when using \fB-c\fR), \fBfoo.s\fR (when using
\fB-S\fR) or \fBfoo.bc\fR (when using \fB--emit-llvm\fR), and \fBfoo.ll\fR
(when using both \fB-S\fR and \fB--emit-llvm\fR).
.TP .TP
\fB--lib\fR: \fB--emit-llvm\fR
Compile and link a library crate into a shared object. Produce an LLVM bitcode file
.TP .TP
\fB--static\fR: \fB-g\fR
Produce a statically-linked binary, or generate a static Produce debug info
library.
.TP .TP
\fB--pretty\fR \fI[type]\fR: \fB--gc\fR
Pretty-print the input. Valid \fItype\fRs are: Garbage collect shared data (experimental/temporary)
.RS
.TP .TP
\fBnormal\fR: Un-annotated source (default). \fB-h --help\fR
Display this message
.TP .TP
\fBexpanded\fR: Crates expanded. \fB-L <path>\fR
Add a directory to the library search path
.TP .TP
\fBtyped\fR: Crates expanded, all expressions annotated with types. \fB--lib\fR
Compile a library crate
.TP .TP
\fBidentified\fR: Fully parenthesized, ast nodes and blocks annotated with IDs. \fB--ls\fR
.RE List the symbols defined by a compiled librar crate
.TP .TP
\fB--ls\fR: \fB--no-asm-comments\fR
Lists symbols defined by the specified \fBcompiled\fR library. Do not add comments into the assembly source
.TP .TP
\fB-L\fR \fIpath\fR: \fB--no-lint-ctypes\fR
Adds \fIpath\fR to the library search path. Suppress warnings for possibly incorrect ctype usage
.TP .TP
\fB--noverify\fR: \fB--no-trans\fR
Disables LLVM verification pass, which does sanity checking of Run all passes except translation; no output
bitcode generated by rustc. Using this option gives a slight speedup, at the
cost of vastly reduced ability to catch rustc bugs. See
<\fBhttp://llvm.org/docs/Passes.html\fR> for a list of properties checked.
.TP .TP
\fB--parse-only\fR: \fB--no-verify\fR
Run the parse phase only. If parsing succeeds, produces no Suppress LLVM verification step (slight speedup)
output. (see http://llvm.org/docs/Passes.html for detail)
.TP .TP
\fB--no-trans\fR: \fB-O\fR
Run all passes except translation. Produces no output. Equivalent to --opt-level=2
.TP .TP
\fB-g\fR: \fB-o <filename>\fR
Produce debug info. Write output to <filename>
.TP .TP
\fB--opt-level\fR \fIlevel\fR: \fB--opt-level <lvl>\fR
Set optimization level to \fIlevel\fR. Optimize with possible levels 0-3
.TP .TP
\fB-O\fR: \fB--out-dir <dir>\fR
Equal to --opt-level=2 Write output to compiler-chosen filename in <dir>
.TP .TP
\fB-S\fR: \fB--parse-only\fR
Compile to assembly, but do not assemble or link. Parse only; do not compile, assemble, or link
.TP .TP
\fB-c\fR: \fB--pretty [type]\fR
Compile and assemble, but do not link. 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)
.TP .TP
\fB--emit-llvm\fR: \fB-S\fR
Generate output files in LLVM format. When used with \fB-S\fR this generate LLVM Compile only; do not assemble or link
intermediate language assembly files, otherwise this generates LLVM bitcode
format object files.
.TP .TP
\fB--save-temps\fR: \fB--save-temps\fR
For foo.rs, save generated bitcode before optimization to Write intermediate files (.bc, .opt.bc, .o) in addition to normal output
\fBfoo.bc\fR, bitcode after optimization to \fBfoo.opt.bc\fR, and the generated
object file to \fBfoo.o\fR.
.TP .TP
\fB--stats\fR: \fB--static\fR
Print statistics about compilation. Use or produce static libraries or binaries
.TP .TP
\fB--cfg\fR \fIcfgspec\fR: \fB--stats\fR
Provide a crate config spec. Print compilation statistics
.TP .TP
\fB--time-passes\fR: \fB--sysroot <path>\fR
Print runtimes of compilation phases. Override the system root
.TP .TP
\fB--time-llvm-passes\fR: \fB--test\fR
Print runtimes of llvm phases. Build test harness
.TP .TP
\fB--sysroot\fR \fIpath\fR: \fB--target <triple>\fR
Set the system root. Default is the directory above Target cpu-manufacturer-kernel[-os] to compile for (default: host triple)
rustc's. (see http://sources.redhat.com/autobook/autobook/autobook_17.html for detail)
.TP .TP
\fB--target\fR \fIgnu-config-name\fR: \fB--time-passes\fR
Set the compilation target, which is a Time the individual phases of the compiler
string of the form \fBcpu\fR-\fBmanufacturer\fR-\fBkernel\fR[-\fBos\fR]. Example
values include "i686-unknown-linux-gnu" and "mips-idt-ecoff"; see
<\fBhttp://sources.redhat.com/autobook/autobook/autobook_17.html\fR>. If not
supplied, the host triple is used (see \fB--version\fR output).
.TP .TP
\fB--test\fR: \fB--time-llvm-passes\fR
Build a test harness. Time the individual phases of the LLVM backend
.TP .TP
\fB--gc\fR: \fB-v --version\fR
\fBEXPERIMENTAL\fR. Garbage-collect shared data. Print version info and exit
.TP .TP
\fB--warn-unused-imports\fR: \fB--warn-unused-imports\fR
Warn about unnecessary imports. Warn about unnecessary imports
.TP
\fB--no-lint-ctypes\fR: .SH "EXAMPLES"
Disables checking of possibly incorrect usage of Rust int or uint types in To build an executable from a source file with a main function:
native function declarations, where types defined in libcore::ctypes should be $ rustc -o hello hello.rs
used instead. Ctypes check emits warnings by default.
To build a library from a source file:
$ rustc --lib hello-lib.rs
To build either with a crate (.rc) file:
$ rustc hello.rc
.SH "BUGS" .SH "BUGS"
See \fBhttps://github.com/mozilla/rust/issues\fR for a list of known bugs. See \fBhttps://github.com/mozilla/rust/issues\fR for a list of known bugs.
.SH "AUTHOR" .SH "AUTHOR"
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
<\fIgraydon@mozilla.com\fR> is the project leader. <\fIgraydon@mozilla.com\fR> is the project leader.
.SH "COPYRIGHT" .SH "COPYRIGHT"
See \fBLICENSE.txt\fR in the rust source distribution. See \fBLICENSE.txt\fR in the rust source distribution.

View file

@ -21,43 +21,52 @@ fn version(argv0: str) {
} }
fn usage(argv0: str) { fn usage(argv0: str) {
io::stdout().write_str(#fmt["usage: %s [options] <input>\n", argv0] + io::stdout().write_str(#fmt["Usage: %s [options] <input>\n", argv0] +
" "
options: Options:
-h --help display this message --bin Compile an executable crate (default)
-v --version print version info and exit -c Compile and assemble, but do not link
--cfg <cfgspec> Configure the compilation environment
--emit-llvm Produce an LLVM bitcode file
-g Produce debug info
--gc Garbage collect shared data (experimental/temporary)
-h --help Display this message
-L <path> Add a directory to the library search path
--lib Compile a library crate
--ls List the symbols defined by a compiled library crate
--no-asm-comments Do not add comments into the assembly source
--no-lint-ctypes Suppress warnings for possibly incorrect ctype usage
--no-trans Run all passes except translation; no output
--no-verify Suppress LLVM verification step (slight speedup)
(see http://llvm.org/docs/Passes.html for detail)
-O Equivalent to --opt-level=2
-o <filename> Write output to <filename>
--opt-level <lvl> Optimize with possible levels 0-3
--out-dir <dir> Write output to compiler-chosen filename in <dir>
--parse-only Parse only; do not compile, assemble, or link
--pretty [type] Pretty-print the input instead of compiling;
valid types are: normal (un-annotated source),
expanded (crates expanded), typed (crates expanded,
with type annotations), or identified (fully
parenthesized, AST nodes and blocks with IDs)
-S Compile only; do not assemble or link
--save-temps Write intermediate files (.bc, .opt.bc, .o)
in addition to normal output
--static Use or produce static libraries or binaries
--stats Print compilation statistics
--sysroot <path> Override the system root
--test Build a test harness
--target <triple> Target cpu-manufacturer-kernel[-os] to compile for
(default: host triple)
(see http://sources.redhat.com/autobook/autobook/
autobook_17.html for detail)
-o <filename> write output to <filename> --time-passes Time the individual phases of the compiler
--out-dir <dir> write output to compiler-chosen filename in <dir> --time-llvm-passes Time the individual phases of the LLVM backend
--lib compile a library crate -v --version Print version info and exit
--bin compile an executable crate (default)
--static use or produce static libraries
--pretty [type] pretty-print the input instead of compiling
--ls list the symbols defined by a crate file
-L <path> add a directory to the library search path
--no-verify suppress LLVM verification step (slight speedup)
--parse-only parse only; do not compile, assemble, or link
--no-trans run all passes except translation; no output
-g produce debug info
--opt-level <lvl> optimize with possible levels 0-3
-O equivalent to --opt-level=2
-S compile only; do not assemble or link
--no-asm-comments do not add comments into the assembly source
-c compile and assemble, but do not link
--emit-llvm produce an LLVM bitcode file
--save-temps write intermediate files in addition to normal output
--stats gather and report various compilation statistics
--cfg <cfgspec> configure the compilation environment
--time-passes time the individual phases of the compiler
--time-llvm-passes time the individual phases of the LLVM backend
--sysroot <path> override the system root
--target <triple> target to compile for (default: host triple)
--test build test harness
--gc garbage collect shared data (experimental/temporary)
--warn-unused-imports --warn-unused-imports
warn about unnecessary imports Warn about unnecessary imports
--no-lint-ctypes suppress lint-style ctypes usage check
"); ");
} }