blob: bb6457dd493e78b0e7f94868e44e359fed64e8de [file] [log] [blame]
.TH RUSTC "1" "October 2012" "rustc 0.4" "User Commands"
.SH NAME
rustc \- rust compiler
.SH SYNOPSIS
.B rustc
[\fIoptions\fR] \fI<input>\fR
.SH DESCRIPTION
This program is a compiler for the Rust language, available at
<\fBhttps://www.rust-lang.org\fR>.
.SH OPTIONS
.TP
\fB\-\-bin\fR
Compile an executable crate (default)
.TP
\fB\-c\fR
Compile and assemble, but do not link
.TP
\fB\-\-cfg\fR <cfgspec>
Configure the compilation environment
.TP
\fB\-\-emit\-llvm\fR
Produce an LLVM bitcode file
.TP
\fB\-g\fR
Produce debug info (experimental)
.TP
\fB\-\-gc\fR
Garbage collect shared data (experimental/temporary)
.TP
\fB\-h\fR \fB\-\-help\fR
Display this message
.TP
\fB\-L\fR <path>
Add a directory to the library search path
.TP
\fB\-\-lib\fR
Compile a library crate
.TP
\fB\-\-ls\fR
List the symbols defined by a compiled library crate
.TP
\fB\-\-jit\fR
Execute using JIT (experimental)
.TP
\fB\-\-no\-trans\fR
Run all passes except translation; no output
.TP
\fB\-O\fR
Equivalent to \fB\-\-opt\-level\fR=\fI2\fR
.TP
\fB\-o\fR <filename>
Write output to <filename>
.TP
\fB\-\-opt\-level\fR <lvl>
Optimize with possible levels 0\-3
.TP
\fB\-\-out\-dir\fR <dir>
Write output to compiler\-chosen filename in <dir>
.TP
\fB\-\-parse\-only\fR
Parse only; do not compile, assemble, or link
.TP
\fB\-\-pretty\fR [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)
.TP
\fB\-S\fR
Compile only; do not assemble or link
.TP
\fB\-\-save\-temps\fR
Write intermediate files (.bc, .opt.bc, .o)
in addition to normal output
.TP
\fB\-\-static\fR
Use or produce static libraries or binaries
(experimental)
.TP
\fB\-\-sysroot\fR <path>
Override the system root
.TP
\fB\-\-test\fR
Build a test harness
.TP
\fB\-\-target\fR <triple>
Target cpu\-manufacturer\-kernel[\-os] to compile for
(default: host triple)
(see http://sources.redhat.com/autobook/autobook/
autobook_17.html for detail)
.TP
\fB\-W help\fR
Print 'lint' options and default settings
.TP
\fB\-Z help\fR
Print internal options for debugging rustc
.TP
\fB\-v\fR \fB\-\-version\fR
Print version info and exit
.SH "EXAMPLES"
To build an executable from a source file with a main function:
$ rustc -o hello hello.rs
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"
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
.SH "AUTHOR"
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
<\fIgraydon@mozilla.com\fR> is the project leader.
.SH "COPYRIGHT"
This work is licensed under MIT-like terms. See \fBLICENSE.txt\fR
in the rust source distribution.