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

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

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

-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. Available debug flags are:

    •   verbose - in general, enable more debug printouts

    •   time-passes - measure time of each rustc pass

    •   count-llvm-insns - count where LLVM instrs originate

    •   time-llvm-passes - measure time of each LLVM pass

    •   trans-stats - gather trans statistics

    •   no-asm-comments - omit comments when using -S

    •   no-verify - skip LLVM verification

    •   trace - emit trace logs

    •   coherence - perform coherence checking

    •   borrowck-stats - gather borrowck statistics

    •   borrowck-note-pure - note where purity is req'd

    •   borrowck-note-loan - note where loans are req'd

    •   no-landing-pads - omit landing pads for unwinding

    •   debug-llvm - enable debug output from LLVM

    •   count-type-sizes - count the sizes of aggregate types

    •   meta-stats - gather metadata statistics

    •   no-opt - do not optimize, even if -O is passed

    •   no-monomorphic-collapse - do not collapse template instantiations

    •   gc - Garbage collect shared data (experimental)

    •   jit - Execute using JIT (experimental)

    •   extra-debug-info - Extra debugging info (experimental)

    •   debug-info - Produce debug info (experimental)

    •   static - Use or produce static libraries or binaries (experimental)

-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 licensed under MIT-like terms. See LICENSE.txt in the rust source distribution.