2014-06-27 18:07:26 +00:00
|
|
|
.TH RUSTC "1" "March 2014" "rustc 0.11.0" "User Commands"
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH NAME
|
2014-04-16 03:32:54 +00:00
|
|
|
rustc \- The Rust compiler
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH SYNOPSIS
|
2012-05-26 15:15:28 +00:00
|
|
|
.B rustc
|
2013-02-15 00:25:47 +00:00
|
|
|
[\fIOPTIONS\fR] \fIINPUT\fR
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
This program is a compiler for the Rust language, available at
|
2012-01-13 03:10:30 +00:00
|
|
|
<\fBhttps://www.rust-lang.org\fR>.
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH OPTIONS
|
2012-05-26 15:15:28 +00:00
|
|
|
|
2014-07-10 19:57:04 +00:00
|
|
|
.TP
|
|
|
|
\fB\-\-crate-name NAME\fR
|
|
|
|
Specify the name of the crate being built
|
2011-10-26 03:05:41 +00: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 23:27:54 +00:00
|
|
|
\fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
|
|
|
|
Configure the flavor of rust crate that is generated (default `bin`)
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-\-cfg\fR SPEC
|
2012-01-31 03:02:20 +00:00
|
|
|
Configure the compilation environment
|
2011-10-26 03:05:41 +00: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 23:27:54 +00:00
|
|
|
\fB\-\-emit=[asm,ir,bc,obj,link]\fR
|
|
|
|
Configure the output that rustc will produce
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-h\fR, \fB\-\-help\fR
|
2012-01-31 03:02:20 +00:00
|
|
|
Display this message
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-L\fR PATH
|
2012-01-31 03:02:20 +00:00
|
|
|
Add a directory to the library search path
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2012-05-26 15:15:28 +00:00
|
|
|
\fB\-\-no\-trans\fR
|
2012-01-31 03:02:20 +00:00
|
|
|
Run all passes except translation; no output
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2014-04-16 03:32:54 +00:00
|
|
|
\fB\-\-no\-analysis\fR
|
|
|
|
Parse and expand the source, but run no analysis and produce no output
|
|
|
|
.TP
|
|
|
|
\fB\-g\fR
|
2014-02-07 03:57:09 +00:00
|
|
|
Emit DWARF debug information into object files generated.
|
|
|
|
.TP
|
2014-04-16 03:32:54 +00:00
|
|
|
\fB\-\-debuginfo\fR LEVEL
|
|
|
|
Emit DWARF debug info to the objects created: 0 = no debug info, 1 =
|
|
|
|
line-tables only (for stacktraces and breakpoints), 2 = full debug
|
|
|
|
info with variable and type information (same as -g).
|
|
|
|
.TP
|
2012-05-26 15:15:28 +00:00
|
|
|
\fB\-O\fR
|
2013-02-15 00:25:47 +00:00
|
|
|
Equivalent to \fI\-\-opt\-level=2\fR
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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 23:27:54 +00:00
|
|
|
Write output to <filename>. Ignored if more than one --emit is specified.
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-\-opt\-level\fR LEVEL
|
|
|
|
Optimize with possible levels 0-3
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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 23:27:54 +00:00
|
|
|
Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
|
|
|
|
(default the current directory)
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2012-05-26 15:15:28 +00:00
|
|
|
\fB\-\-parse\-only\fR
|
2012-01-31 03:02:20 +00:00
|
|
|
Parse only; do not compile, assemble, or link
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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-26 03:05:41 +00:00
|
|
|
.TP
|
2014-04-16 03:32:54 +00:00
|
|
|
\fB\-\-dep-info\fR [FILENAME]
|
|
|
|
Output dependency info to <filename> after compiling, in o format suitable
|
|
|
|
for use by Makefiles.
|
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-\-sysroot\fR PATH
|
2012-01-31 03:02:20 +00:00
|
|
|
Override the system root
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2012-05-26 15:15:28 +00:00
|
|
|
\fB\-\-test\fR
|
|
|
|
Build a test harness
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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-07 04:06:54 +00:00
|
|
|
for details)
|
2012-10-10 22:29:01 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-W\fR help
|
2012-10-10 23:35:52 +00:00
|
|
|
Print 'lint' options and default settings
|
2011-10-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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-26 03:05:41 +00:00
|
|
|
.TP
|
2013-02-15 00:25:47 +00: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
|
2014-02-07 03:57:09 +00:00
|
|
|
\fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
|
2014-05-12 22:49:39 +00:00
|
|
|
Set a codegen-related flag to the value specified. Use "-C help" to print
|
2014-02-07 03:57:09 +00:00
|
|
|
available flags. See CODEGEN OPTIONS below
|
|
|
|
.TP
|
2013-02-15 00:25:47 +00:00
|
|
|
\fB\-v\fR, \fB\-\-version\fR
|
2012-05-26 15:15:28 +00:00
|
|
|
Print version info and exit
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2014-02-07 03:57:09 +00:00
|
|
|
.SH CODEGEN OPTIONS
|
|
|
|
|
|
|
|
.TP
|
|
|
|
\fBar\fR=/path/to/ar
|
|
|
|
Path to the archive utility to use when assembling archives.
|
|
|
|
.TP
|
|
|
|
\fBlinker\fR=/path/to/cc
|
|
|
|
Path to the linker utility to use when linking libraries, executables, and
|
|
|
|
objects.
|
|
|
|
.TP
|
|
|
|
\fBlink-args\fR='-flag1 -flag2'
|
|
|
|
A space-separated list of extra arguments to pass to the linker when the linker
|
|
|
|
is invoked.
|
|
|
|
.TP
|
|
|
|
\fBtarget-cpu\fR=help
|
|
|
|
Selects a target processor. If the value is 'help', then a list of available
|
2014-05-12 22:49:39 +00:00
|
|
|
CPUs is printed.
|
2014-02-07 03:57:09 +00:00
|
|
|
.TP
|
|
|
|
\fBtarget-feature\fR='+feature1 -feature2'
|
|
|
|
A space-separated list of features to enable or disable for the target. A
|
|
|
|
preceding '+' enables a feature while a preceding '-' disables it. Available
|
|
|
|
features can be discovered through target-cpu=help.
|
|
|
|
.TP
|
|
|
|
\fBpasses\fR=list
|
|
|
|
A space-separated list of extra LLVM passes to run. A value of 'list' will
|
|
|
|
cause rustc to print all known passes and exit. The passes specified are
|
|
|
|
appended at the end of the normal pass manager.
|
|
|
|
.TP
|
|
|
|
\fBllvm-args\fR='-arg1 -arg2'
|
2014-05-12 22:49:39 +00:00
|
|
|
A space-separated list of arguments to pass through to LLVM.
|
2014-02-07 03:57:09 +00:00
|
|
|
.TP
|
|
|
|
\fBsave-temps\fR
|
|
|
|
If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated
|
|
|
|
throughout compilation in the output directory.
|
|
|
|
.TP
|
2014-06-11 21:52:38 +00:00
|
|
|
\fBrpath\fR
|
|
|
|
If specified, then the rpath value for dynamic libraries will be set in
|
2014-02-07 03:57:09 +00:00
|
|
|
either dynamic library or executable outputs.
|
|
|
|
.TP
|
|
|
|
\fBno-prepopulate-passes\fR
|
|
|
|
Suppresses pre-population of the LLVM pass manager that is run over the module.
|
|
|
|
.TP
|
|
|
|
\fBno-vectorize-loops\fR
|
|
|
|
Suppresses running the loop vectorization LLVM pass, regardless of optimization
|
|
|
|
level.
|
|
|
|
.TP
|
|
|
|
\fBno-vectorize-slp\fR
|
|
|
|
Suppresses running the LLVM SLP vectorization pass, regardless of optimization
|
|
|
|
level.
|
|
|
|
.TP
|
|
|
|
\fBsoft-float\fR
|
|
|
|
Generates software floating point library calls instead of hardware
|
|
|
|
instructions.
|
|
|
|
.TP
|
|
|
|
\fBprefer-dynamic\fR
|
|
|
|
Prefers dynamic linking to static linking.
|
|
|
|
.TP
|
|
|
|
\fBno-integrated-as\fR
|
|
|
|
Force usage of an external assembler rather than LLVM's integrated one.
|
2014-04-16 03:32:54 +00:00
|
|
|
.TP
|
|
|
|
\fBrelocation-model\fR=[pic,static,dynamic-no-pic]
|
|
|
|
The relocation model to use. (default: pic)
|
2014-02-07 03:57:09 +00:00
|
|
|
|
2012-01-31 03:02:20 +00: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 23:27:54 +00:00
|
|
|
$ rustc --crate-type=lib hello-lib.rs
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2014-01-23 01:36:08 +00:00
|
|
|
To build either with a crate (.rs) file:
|
|
|
|
$ rustc hello.rs
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2014-02-07 03:57:09 +00:00
|
|
|
To build an executable with debug info:
|
|
|
|
$ rustc -g -o hello hello.rs
|
2013-02-15 00:25:47 +00:00
|
|
|
|
2013-07-07 04:06:54 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
|
2014-02-02 07:56:55 +00:00
|
|
|
rustdoc
|
2013-02-15 00:25:47 +00:00
|
|
|
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH "BUGS"
|
2014-06-16 23:07:34 +00:00
|
|
|
See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues.
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH "AUTHOR"
|
2014-04-14 21:55:40 +00:00
|
|
|
See \fBAUTHORS.txt\fR in the Rust source distribution.
|
2012-01-31 03:02:20 +00:00
|
|
|
|
2011-10-26 03:05:41 +00:00
|
|
|
.SH "COPYRIGHT"
|
2013-04-08 08:19:16 +00:00
|
|
|
This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR
|
|
|
|
file in the rust source distribution.
|