RUSTC(1)

NAME
rustc - rust compiler

SYNOPSIS
rustc [OPTIONS] INPUT

DESCRIPTION
This program is a compiler for the Rust language, available at <https://www.rust-lang.org>.

OPTIONS

--bin
    Compile an executable crate (default)

-c  Compile and assemble, but do not link

--cfg SPEC
    Configure the compilation environment

--emit-llvm
    Produce an LLVM bitcode file

-h, --help
    Display this message

-L PATH
    Add a directory to the library search path

--lib
    Compile a library crate

--linker LINKER
    Program to use for linking instead of the default

--link-args FLAGS
    A space-separated list of flags passed to the linker

--ls
    List the symbols defined by a library crate

--no-trans
    Run all passes except translation; no output

-O  Equivalent to --opt-level=2

-o FILENAME
    Write output to <filename>

--opt-level LEVEL
    Optimize with possible levels 0-3

--passes 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.

--out-dir DIR
    Write output to compiler-chosen filename in <dir>

--parse-only
    Parse only; do not compile, assemble, or link

--pretty [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)

-S  Compile only; do not assemble or link

--save-temps
    Write intermediate files (.bc, .opt.bc, .o) in addition to normal output

--sysroot PATH
    Override the system root

--test
    Build a test harness

--target TRIPLE
    Target triple cpu-manufacturer-kernel[-os] to compile for (see http://sources.redhat.com/autobook/autobook/autobook_17.html for detail)

--target-feature TRIPLE
    Target-specific attributes (see llc -mattr=help for detail)

--android-cross-path PATH
    The path to the Android NDK

-W help
    Print 'lint' options and default settings

-W OPT, --warn OPT
    Set lint warnings

-A OPT, --allow OPT
    Set lint allowed

-D OPT, --deny OPT
    Set lint denied

-F OPT, --forbid OPT
    Set lint forbidden

-Z FLAG
    Set internal debugging options. Use "-Z help" to print available options.

-v, --version
    Print version info and exit

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 To build an executable with debug info (experimental):
    $ rustc -Z debug-info -o hello hello.rs

BUGS
See <https://github.com/mozilla/rust/issues> for issues.

AUTHOR
See AUTHORS.txt in the rust source distribution. Graydon Hoare <graydon@mozilla.com> is the project leader.

COPYRIGHT
This work is dual-licensed under Apache 2.0 and MIT terms. See COPYRIGHT file in the rust source distribution.