.TH RUSTC "1" "March 2014" "rustc 0.11.0" "User Commands" .SH NAME rustc \- The Rust compiler .SH SYNOPSIS .B rustc [\fIOPTIONS\fR] \fIINPUT\fR .SH DESCRIPTION This program is a compiler for the Rust language, available at <\fBhttps://www.rust-lang.org\fR>. .SH OPTIONS .TP \fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR Configure the flavor of rust crate that is generated (default `bin`) .TP \fB\-\-cfg\fR SPEC Configure the compilation environment .TP \fB\-\-emit=[asm,ir,bc,obj,link]\fR Configure the output that rustc will produce .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\-\-no\-trans\fR Run all passes except translation; no output .TP \fB\-\-no\-analysis\fR Parse and expand the source, but run no analysis and produce no output .TP \fB\-g\fR Emit DWARF debug information into object files generated. .TP \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 \fB\-O\fR Equivalent to \fI\-\-opt\-level=2\fR .TP \fB\-o\fR FILENAME Write output to . Ignored if more than one --emit is specified. .TP \fB\-\-opt\-level\fR LEVEL Optimize with possible levels 0-3 .TP \fB\-\-out\-dir\fR DIR Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory) .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\-\-dep-info\fR [FILENAME] Output dependency info to after compiling, in o format suitable for use by Makefiles. .TP \fB\-\-sysroot\fR PATH Override the system root .TP \fB\-\-test\fR Build a test harness .TP \fB\-\-target\fR TRIPLE Target triple cpu-manufacturer-kernel[-os] to compile for (see http://sources.redhat.com/autobook/autobook/autobook_17.html for details) .TP \fB\-W\fR help Print 'lint' options and default settings .TP \fB\-W\fR OPT, \fB\-\-warn\fR OPT Set lint warnings .TP \fB\-A\fR OPT, \fB\-\-allow\fR OPT Set lint allowed .TP \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\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL] Set a codegen-related flag to the value specified. Use "-C help" to print available flags. See CODEGEN OPTIONS below .TP \fB\-v\fR, \fB\-\-version\fR Print version info and exit .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 CPUs is printed. .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' A space-separated list of arguments to pass through to LLVM. .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 \fBno-rpath\fR If specified, then the rpath value for dynamic libraries will not be set in 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. .TP \fBrelocation-model\fR=[pic,static,dynamic-no-pic] The relocation model to use. (default: pic) .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 --crate-type=lib hello-lib.rs To build either with a crate (.rs) file: $ rustc hello.rs To build an executable with debug info: $ rustc -g -o hello hello.rs .SH "SEE ALSO" rustdoc .SH "BUGS" See <\fBhttps://github.com/rust-lang/rust/issues\fR> for issues. .SH "AUTHOR" See \fBAUTHORS.txt\fR in the Rust source distribution. .SH "COPYRIGHT" This work is dual-licensed under Apache 2.0 and MIT terms. See \fBCOPYRIGHT\fR file in the rust source distribution.