User Tools

Site Tools


rustc_help

rustc help

Return to rustc, Rust or rustup

Usage: rustc [OPTIONS] INPUT

Options:

-h, –help Display this message

–cfg SPEC Configure the Rust compilation environment

-L [KIND=]PATH Add a directory to the library search path. The optional KIND can be one of Rust dependency, crate, Rust native, Rust framework, or all (the default).

-l [KIND[:MODIFIERS]=]NAME[:RENAME]

Link the generated crate(s) to the specified Rust native library NAME. The optional KIND can be one of static, framework, or dylib (the default).

Optional comma separated MODIFIERS

(bundle|verbatim|whole-archive|as-needed) may be specified each with a prefix of either '+' to enable or '-' to disable.

       --crate-type [bin|lib|rlib|dylib|cdylib|staticlib|proc-macro]
                       Comma separated list of types of crates
                       for the compiler to emit
       --crate-name NAME
                       Specify the name of the crate being built
       --edition 2015|2018|2021
                       Specify which edition of the compiler to use when
                       compiling code.
       --emit [asm|llvm-bc|llvm-ir|obj|metadata|link|dep-info|mir]
                       Comma separated list of types of output for the
                       compiler to emit
       --print [crate-name|file-names|sysroot|target-libdir|cfg|target-list|target-cpus|target-features|relocation-models|code-models|tls-models|target-spec-json|native-static-libs]
                       Compiler information to print on stdout
   -g                  Equivalent to -C debuginfo=2
   -O                  Equivalent to -C opt-level=2
   -o FILENAME         Write output to 
       --out-dir DIR   Write output to compiler-chosen filename in 
       --explain OPT   Provide a detailed explanation of an error message
       --test          Build a test harness
       --target TARGET Target triple for which the code is compiled
   -W, --warn OPT      Set lint warnings
   -A, --allow OPT     Set lint allowed
   -D, --deny OPT      Set lint denied
   -F, --forbid OPT    Set lint forbidden
       --cap-lints LEVEL
                       Set the most restrictive lint level. More restrictive
                       lints are capped at this level
       --force-warns LINT
                       Specifiy lints that should warn even if they are
                       allowed somewhere else
   -C, --codegen OPT[=VALUE]
                       Set a codegen option
   -V, --version       Print version info and exit
   -v, --verbose       Use verbose output

Additional help:

   -C help             Print codegen options
   -W help             Print 'lint' options and default settings
   --help -v           Print the full set of options rustc accepts

rustc_help.txt · Last modified: 2024/04/28 03:25 by 127.0.0.1