2015-05-27 01:03:41 +02:00
|
|
|
.TH RUSTC "1" "August 2015" "rustc 1.2.0" "User Commands"
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH NAME
|
2014-04-16 05:32:54 +02:00
|
|
|
rustc \- The Rust compiler
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH SYNOPSIS
|
2012-05-26 17:15:28 +02:00
|
|
|
.B rustc
|
2013-02-15 01:25:47 +01:00
|
|
|
[\fIOPTIONS\fR] \fIINPUT\fR
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH DESCRIPTION
|
|
|
|
This program is a compiler for the Rust language, available at
|
2015-02-26 10:10:17 +01:00
|
|
|
.UR https://www.rust\-lang.org
|
|
|
|
.UE .
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH OPTIONS
|
2012-05-26 17:15:28 +02:00
|
|
|
|
2014-07-10 21:57:04 +02:00
|
|
|
.TP
|
2014-12-22 11:32:29 +01:00
|
|
|
\fB\-h\fR, \fB\-\-help\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Display the help message.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-cfg\fR \fISPEC\fR
|
|
|
|
Configure the compilation environment.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-L\fR [\fIKIND\fR=]\fIPATH\fR
|
|
|
|
Add a directory to the library search path.
|
|
|
|
The optional \fIKIND\fR can be one of:
|
|
|
|
.RS
|
2015-02-04 22:47:06 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBdependency\fR
|
|
|
|
only lookup transitive dependencies here
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
.B crate
|
|
|
|
only lookup local `extern crate` directives here
|
2014-04-16 05:32:54 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
.B native
|
|
|
|
only lookup native libraries here
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
.B framework
|
|
|
|
only look for OSX frameworks here
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
.B all
|
|
|
|
look for anything here (the default)
|
|
|
|
.RE
|
|
|
|
.TP
|
|
|
|
\fB\-l\fR [\fIKIND\fR=]\fINAME\fR
|
2015-08-18 19:59:18 +02:00
|
|
|
Link the generated crate(s) to the specified library \fINAME\fR.
|
2015-02-26 10:10:17 +01:00
|
|
|
The optional \fIKIND\fR can be one of \fIstatic\fR, \fIdylib\fR, or
|
|
|
|
\fIframework\fR.
|
|
|
|
If omitted, \fIdylib\fR is assumed.
|
|
|
|
.TP
|
|
|
|
\fB\-\-crate\-type\fR [bin|lib|rlib|dylib|staticlib]
|
|
|
|
Comma separated list of types of crates for the compiler to emit.
|
|
|
|
.TP
|
|
|
|
\fB\-\-crate\-name\fR \fINAME\fR
|
|
|
|
Specify the name of the crate being built.
|
|
|
|
.TP
|
2015-12-04 20:11:04 +01:00
|
|
|
\fB\-\-emit\fR [asm|llvm\-bc|llvm\-ir|obj|link|dep\-info][=\fIPATH\fR]
|
|
|
|
Configure the output that \fBrustc\fR will produce.
|
|
|
|
|
|
|
|
Each emission may also have an optional explicit output \fIPATH\fR specified for that particular
|
|
|
|
emission kind. This path takes precedence over the \fB-o\fR option.
|
2015-02-26 10:10:17 +01:00
|
|
|
.TP
|
|
|
|
\fB\-\-print\fR [crate\-name|file\-names|sysroot]
|
|
|
|
Comma separated list of compiler information to print on stdout.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
|
|
|
\fB\-g\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Equivalent to \fI\-C\ debuginfo=2\fR.
|
2014-04-16 05:32:54 +02:00
|
|
|
.TP
|
2012-05-26 17:15:28 +02:00
|
|
|
\fB\-O\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Equivalent to \fI\-C\ opt\-level=2\fR.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-o\fR \fIFILENAME\fR
|
|
|
|
Write output to \fIFILENAME\fR.
|
2015-09-30 19:08:37 +02:00
|
|
|
Ignored if multiple \fI\-\-emit\fR outputs are specified which don't have an
|
|
|
|
explicit path otherwise.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-out\-dir\fR \fIDIR\fR
|
|
|
|
Write output to compiler\[hy]chosen filename in \fIDIR\fR.
|
|
|
|
Ignored if \fI\-o\fR is specified.
|
|
|
|
Defaults to the current directory.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-explain\fR \fIOPT\fR
|
|
|
|
Provide a detailed explanation of an error message.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2012-05-26 17:15:28 +02:00
|
|
|
\fB\-\-test\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Build a test harness.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-target\fR \fITRIPLE\fR
|
|
|
|
Target triple \fIcpu\fR\-\fImanufacturer\fR\-\fIkernel\fR[\-\fIos\fR]
|
|
|
|
to compile for (see chapter 3.4 of
|
|
|
|
.UR http://www.sourceware.org/autobook/
|
|
|
|
.UE
|
|
|
|
for details).
|
2012-10-11 00:29:01 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-W help\fR
|
|
|
|
Print 'lint' options and default settings.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-W\fR \fIOPT\fR, \fB\-\-warn\fR \fIOPT\fR
|
|
|
|
Set lint warnings.
|
2013-02-15 01:25:47 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-A\fR \fIOPT\fR, \fB\-\-allow\fR \fIOPT\fR
|
|
|
|
Set lint allowed.
|
2011-10-26 05:05:41 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-D\fR \fIOPT\fR, \fB\-\-deny\fR \fIOPT\fR
|
|
|
|
Set lint denied.
|
2013-02-15 01:25:47 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-F\fR \fIOPT\fR, \fB\-\-forbid\fR \fIOPT\fR
|
|
|
|
Set lint forbidden.
|
2013-02-15 01:25:47 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-C\fR \fIFLAG\fR[=\fIVAL\fR], \fB\-\-codegen\fR \fIFLAG\fR[=\fIVAL\fR]
|
|
|
|
Set a codegen\[hy]related flag to the value specified.
|
|
|
|
Use \fI\-C help\fR to print available flags.
|
|
|
|
See CODEGEN OPTIONS below.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2014-12-22 11:32:29 +01:00
|
|
|
\fB\-V\fR, \fB\-\-version\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Print version info and exit.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
|
|
|
\fB\-v\fR, \fB\-\-verbose\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Use verbose output.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-extern\fR \fINAME\fR=\fIPATH\fR
|
2015-08-18 19:59:18 +02:00
|
|
|
Specify where an external rust library is located. These should match
|
|
|
|
\fIextern\fR declarations in the crate's source code.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-\-sysroot\fR \fIPATH\fR
|
|
|
|
Override the system root.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fB\-Z\fR \fIFLAG\fR
|
|
|
|
Set internal debugging options.
|
|
|
|
Use \fI\-Z help\fR to print available options.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
|
|
|
\fB\-\-color\fR auto|always|never
|
|
|
|
Configure coloring of output:
|
2015-02-26 10:10:17 +01:00
|
|
|
.RS
|
|
|
|
.TP
|
|
|
|
.B auto
|
|
|
|
colorize, if output goes to a tty (default);
|
|
|
|
.TP
|
|
|
|
.B always
|
|
|
|
always colorize output;
|
|
|
|
.TP
|
|
|
|
.B never
|
|
|
|
never colorize output.
|
|
|
|
.RE
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2014-02-07 04:57:09 +01:00
|
|
|
.SH CODEGEN OPTIONS
|
|
|
|
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBar\fR=\fI/path/to/ar\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Path to the archive utility to use when assembling archives.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBlinker\fR=\fI/path/to/cc\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Path to the linker utility to use when linking libraries, executables, and
|
|
|
|
objects.
|
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBlink\-args\fR='\fI\-flag1 \-flag2\fR'
|
2015-02-26 10:10:17 +01:00
|
|
|
A space\[hy]separated list of extra arguments to pass to the linker when the linker
|
2014-02-07 04:57:09 +01:00
|
|
|
is invoked.
|
|
|
|
.TP
|
2014-12-22 11:32:29 +01:00
|
|
|
\fBlto\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
Perform LLVM link\[hy]time optimizations.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBtarget\-cpu\fR=\fIhelp\fR
|
|
|
|
Selects a target processor.
|
|
|
|
If the value is 'help', then a list of available CPUs is printed.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBtarget\-feature\fR='\fI+feature1\fR,\fI\-feature2\fR'
|
2015-02-26 10:10:17 +01:00
|
|
|
A comma\[hy]separated list of features to enable or disable for the target.
|
|
|
|
A preceding '+' enables a feature while a preceding '\-' disables it.
|
2015-05-27 01:06:43 +02:00
|
|
|
Available features can be discovered through \fIllc -mcpu=help\fR.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBpasses\fR=\fIval\fR
|
2015-02-26 10:10:17 +01:00
|
|
|
A space\[hy]separated list of extra LLVM passes to run.
|
|
|
|
A value of 'list' will cause \fBrustc\fR to print all known passes and
|
|
|
|
exit.
|
|
|
|
The passes specified are appended at the end of the normal pass manager.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBllvm\-args\fR='\fI\-arg1\fR \fI\-arg2\fR'
|
2015-02-26 10:10:17 +01:00
|
|
|
A space\[hy]separated list of arguments to pass through to LLVM.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBsave\-temps\fR
|
|
|
|
If specified, the compiler will save more files (.bc, .o, .no\-opt.bc) generated
|
2014-02-07 04:57:09 +01:00
|
|
|
throughout compilation in the output directory.
|
|
|
|
.TP
|
2014-06-11 23:52:38 +02:00
|
|
|
\fBrpath\fR
|
|
|
|
If specified, then the rpath value for dynamic libraries will be set in
|
2014-02-07 04:57:09 +01:00
|
|
|
either dynamic library or executable outputs.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-prepopulate\-passes\fR
|
|
|
|
Suppresses pre\[hy]population of the LLVM pass manager that is run over the module.
|
2014-02-07 04:57:09 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-vectorize\-loops\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Suppresses running the loop vectorization LLVM pass, regardless of optimization
|
|
|
|
level.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-vectorize\-slp\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Suppresses running the LLVM SLP vectorization pass, regardless of optimization
|
|
|
|
level.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBsoft\-float\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Generates software floating point library calls instead of hardware
|
|
|
|
instructions.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBprefer\-dynamic\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Prefers dynamic linking to static linking.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-integrated\-as\fR
|
2014-02-07 04:57:09 +01:00
|
|
|
Force usage of an external assembler rather than LLVM's integrated one.
|
2014-04-16 05:32:54 +02:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-redzone\fR
|
2014-12-22 11:32:29 +01:00
|
|
|
Disable the use of the redzone.
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBrelocation\-model\fR=[pic,static,dynamic\-no\-pic]
|
|
|
|
The relocation model to use.
|
|
|
|
(Default: \fIpic\fR)
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBcode\-model\fR=[small,kernel,medium,large]
|
2014-12-22 11:32:29 +01:00
|
|
|
Choose the code model to use.
|
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBmetadata\fR=\fIval\fR
|
2014-12-22 11:32:29 +01:00
|
|
|
Metadata to mangle symbol names with.
|
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBextra\-filename\fR=\fIval\fR
|
2014-12-22 11:32:29 +01:00
|
|
|
Extra data to put in each output filename.
|
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBcodegen\-units\fR=\fIn\fR
|
|
|
|
Divide crate into \fIn\fR units to optimize in parallel.
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBremark\fR=\fIval\fR
|
2014-12-22 11:32:29 +01:00
|
|
|
Print remarks for these optimization passes (space separated, or "all").
|
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBno\-stack\-check\fR
|
|
|
|
Disable checks for stack exhaustion (a memory\[hy]safety hazard!).
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 23:50:16 +01:00
|
|
|
\fBdebuginfo\fR=\fIval\fR
|
2014-12-22 11:32:29 +01:00
|
|
|
Debug info emission level:
|
2015-02-26 10:10:17 +01:00
|
|
|
.RS
|
|
|
|
.TP
|
|
|
|
.B 0
|
|
|
|
no debug info;
|
|
|
|
.TP
|
|
|
|
.B 1
|
|
|
|
line\[hy]tables only (for stacktraces and breakpoints);
|
|
|
|
.TP
|
|
|
|
.B 2
|
|
|
|
full debug info with variable and type information.
|
|
|
|
.RE
|
2014-12-22 11:32:29 +01:00
|
|
|
.TP
|
2015-02-26 10:10:17 +01:00
|
|
|
\fBopt\-level\fR=\fIVAL\fR
|
|
|
|
Optimize with possible levels 0\[en]3
|
2014-02-07 04:57:09 +01:00
|
|
|
|
2015-03-20 15:53:47 +01:00
|
|
|
.SH ENVIRONMENT
|
2015-03-19 21:38:06 +01:00
|
|
|
|
|
|
|
Some of these affect the output of the compiler, while others affect programs
|
|
|
|
which link to the standard library.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
\fBRUST_TEST_THREADS\fR
|
|
|
|
The test framework Rust provides executes tests in parallel. This variable sets
|
|
|
|
the maximum number of threads used for this purpose.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
\fBRUST_TEST_NOCAPTURE\fR
|
|
|
|
A synonym for the --nocapture flag.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
\fBRUST_MIN_STACK\fR
|
|
|
|
Sets the minimum stack size for new threads.
|
|
|
|
|
|
|
|
.TP
|
|
|
|
\fBRUST_BACKTRACE\fR
|
|
|
|
If set, produces a backtrace in the output of a program which panics.
|
|
|
|
|
2012-01-31 04:02:20 +01:00
|
|
|
.SH "EXAMPLES"
|
|
|
|
To build an executable from a source file with a main function:
|
2015-02-26 10:10:17 +01:00
|
|
|
$ rustc \-o hello hello.rs
|
2012-01-31 04:02:20 +01:00
|
|
|
|
|
|
|
To build a library from a source file:
|
2015-02-26 10:10:17 +01:00
|
|
|
$ rustc \-\-crate\-type=lib hello\-lib.rs
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2014-01-23 02:36:08 +01:00
|
|
|
To build either with a crate (.rs) file:
|
|
|
|
$ rustc hello.rs
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2014-02-07 04:57:09 +01:00
|
|
|
To build an executable with debug info:
|
2015-02-26 10:10:17 +01:00
|
|
|
$ rustc \-g \-o hello hello.rs
|
2013-02-15 01:25:47 +01:00
|
|
|
|
2013-07-07 06:06:54 +02:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
|
2015-02-26 10:10:17 +01:00
|
|
|
.BR rustdoc (1)
|
2013-02-15 01:25:47 +01:00
|
|
|
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH "BUGS"
|
2015-02-26 10:10:17 +01:00
|
|
|
See
|
|
|
|
.UR https://github.com/rust\-lang/rust/issues
|
|
|
|
.UE
|
|
|
|
for issues.
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH "AUTHOR"
|
2015-02-26 10:10:17 +01:00
|
|
|
See \fIAUTHORS.txt\fR in the Rust source distribution.
|
2012-01-31 04:02:20 +01:00
|
|
|
|
2011-10-26 05:05:41 +02:00
|
|
|
.SH "COPYRIGHT"
|
2015-02-26 10:10:17 +01:00
|
|
|
This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
|
|
|
|
See \fICOPYRIGHT\fR file in the rust source distribution.
|