2013-06-27 18:39:06 -05:00
|
|
|
.TH RUSTC "1" "July 2013" "rustc 0.7" "User Commands"
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH NAME
|
|
|
|
rustc \- rust compiler
|
|
|
|
.SH SYNOPSIS
|
2012-05-26 10:15:28 -05:00
|
|
|
.B rustc
|
2013-02-14 18:25:47 -06:00
|
|
|
[\fIOPTIONS\fR] \fIINPUT\fR
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH DESCRIPTION
|
|
|
|
This program is a compiler for the Rust language, available at
|
2012-01-12 21:10:30 -06:00
|
|
|
<\fBhttps://www.rust-lang.org\fR>.
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH OPTIONS
|
2012-05-26 10:15:28 -05:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-03 17:27:54 -06:00
|
|
|
\fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
|
|
|
|
Configure the flavor of rust crate that is generated (default `bin`)
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-\-cfg\fR SPEC
|
2012-01-30 21:02:20 -06:00
|
|
|
Configure the compilation environment
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-03 17:27:54 -06:00
|
|
|
\fB\-\-emit=[asm,ir,bc,obj,link]\fR
|
|
|
|
Configure the output that rustc will produce
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-h\fR, \fB\-\-help\fR
|
2012-01-30 21:02:20 -06:00
|
|
|
Display this message
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-L\fR PATH
|
2012-01-30 21:02:20 -06:00
|
|
|
Add a directory to the library search path
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-06-27 18:39:06 -05:00
|
|
|
\fB\-\-linker\fR LINKER
|
|
|
|
Program to use for linking instead of the default
|
|
|
|
.TP
|
|
|
|
\fB\-\-link-args\fR FLAGS
|
|
|
|
A space-separated list of flags passed to the linker
|
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-\-ls\fR
|
2013-02-14 18:25:47 -06:00
|
|
|
List the symbols defined by a library crate
|
2012-10-10 17:29:01 -05:00
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-\-no\-trans\fR
|
2012-01-30 21:02:20 -06:00
|
|
|
Run all passes except translation; no output
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-O\fR
|
2013-02-14 18:25:47 -06:00
|
|
|
Equivalent to \fI\-\-opt\-level=2\fR
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-o\fR FILENAME
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-03 17:27:54 -06:00
|
|
|
Write output to <filename>. Ignored if more than one --emit is specified.
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-\-opt\-level\fR LEVEL
|
|
|
|
Optimize with possible levels 0-3
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-06-27 18:39:06 -05:00
|
|
|
\fB\-\-passes\fR NAMES
|
|
|
|
Comma- or space-separated list of optimization passes. Overrides
|
|
|
|
the default passes for the optimization level. A value of 'list'
|
|
|
|
will list the available passes.
|
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-\-out\-dir\fR DIR
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-03 17:27:54 -06:00
|
|
|
Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
|
|
|
|
(default the current directory)
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-\-parse\-only\fR
|
2012-01-30 21:02:20 -06:00
|
|
|
Parse only; do not compile, assemble, or link
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\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)
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-\-save\-temps\fR
|
2013-02-14 18:25:47 -06:00
|
|
|
Write intermediate files (.bc, .opt.bc, .o) in addition to normal output
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-\-sysroot\fR PATH
|
2012-01-30 21:02:20 -06:00
|
|
|
Override the system root
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2012-05-26 10:15:28 -05:00
|
|
|
\fB\-\-test\fR
|
|
|
|
Build a test harness
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-\-target\fR TRIPLE
|
|
|
|
Target triple cpu-manufacturer-kernel[-os] to compile for (see
|
|
|
|
http://sources.redhat.com/autobook/autobook/autobook_17.html
|
2013-07-06 23:06:54 -05:00
|
|
|
for details)
|
2012-10-10 17:29:01 -05:00
|
|
|
.TP
|
2013-06-27 18:39:06 -05:00
|
|
|
\fB\-\-target-feature\fR TRIPLE
|
2013-07-06 23:06:54 -05:00
|
|
|
Target-specific attributes (see llc -mattr=help for details)
|
2013-06-27 18:39:06 -05:00
|
|
|
.TP
|
|
|
|
\fB\-\-android-cross-path\fR PATH
|
|
|
|
The path to the Android NDK
|
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-W\fR help
|
2012-10-10 18:35:52 -05:00
|
|
|
Print 'lint' options and default settings
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-W\fR OPT, \fB\-\-warn\fR OPT
|
|
|
|
Set lint warnings
|
|
|
|
.TP
|
|
|
|
\fB\-A\fR OPT, \fB\-\-allow\fR OPT
|
|
|
|
Set lint allowed
|
2011-10-25 22:05:41 -05:00
|
|
|
.TP
|
2013-02-14 18:25:47 -06:00
|
|
|
\fB\-D\fR OPT, \fB\-\-deny\fR OPT
|
|
|
|
Set lint denied
|
|
|
|
.TP
|
|
|
|
\fB\-F\fR OPT, \fB\-\-forbid\fR OPT
|
|
|
|
Set lint forbidden
|
|
|
|
.TP
|
|
|
|
\fB\-Z\fR FLAG
|
|
|
|
Set internal debugging options. Use "-Z help" to print available options.
|
|
|
|
.TP
|
|
|
|
\fB\-v\fR, \fB\-\-version\fR
|
2012-05-26 10:15:28 -05:00
|
|
|
Print version info and exit
|
2012-01-30 21:02:20 -06:00
|
|
|
|
|
|
|
.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:
|
Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:
* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]
The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.
The new logic for files that rustc emits is as follows:
1. Output types are dictated by the --emit flag. The default value is
--emit=link, and this option can be passed multiple times and have all
options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
attribute. The flags can be passed many times and stack with the crate
attribute.
3. If the -o flag is specified, and only one output type is specified, the
output will be emitted at this location. If more than one output type is
specified, then the filename of -o is ignored, and all output goes in the
directory that -o specifies. The -o option always ignores the --out-dir
option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
directory of the process.
6. When multiple output types are specified, the filestem of all output is the
same as the name of the CrateId (derived from a crate attribute or from the
filestem of the crate file).
Closes #7791
Closes #11056
Closes #11667
2014-02-03 17:27:54 -06:00
|
|
|
$ rustc --crate-type=lib hello-lib.rs
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2014-01-22 19:36:08 -06:00
|
|
|
To build either with a crate (.rs) file:
|
|
|
|
$ rustc hello.rs
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2013-02-14 18:25:47 -06:00
|
|
|
To build an executable with debug info (experimental):
|
|
|
|
$ rustc -Z debug-info -o hello hello.rs
|
|
|
|
|
2013-07-06 23:06:54 -05:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
|
2014-02-02 01:56:55 -06:00
|
|
|
rustdoc
|
2013-02-14 18:25:47 -06:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH "BUGS"
|
2012-10-10 17:29:01 -05:00
|
|
|
See <\fBhttps://github.com/mozilla/rust/issues\fR> for issues.
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH "AUTHOR"
|
|
|
|
See \fBAUTHORS.txt\fR in the rust source distribution. Graydon Hoare
|
|
|
|
<\fIgraydon@mozilla.com\fR> is the project leader.
|
2012-01-30 21:02:20 -06:00
|
|
|
|
2011-10-25 22:05:41 -05:00
|
|
|
.SH "COPYRIGHT"
|
2013-04-08 03:19:16 -05:00
|
|
|
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
|
|
|
|
file in the rust source distribution.
|