OS Manuals

/usr/bin/rustc

Empowering everyone to build reliable and efficient software.

From rust-1.96 1.96.1-r4 (os), captured 2026-11-05 by running rustc --help (exit 0). permalink

Usage: rustc [OPTIONS] INPUT

Options:
    -h, --help          Display this message
        --cfg <SPEC>    Configure the compilation environment.
                        SPEC supports the syntax `<NAME>[="<VALUE>"]`.
        --check-cfg <SPEC>
                        Provide list of expected cfgs for checking
    -L [<KIND>=]<PATH>  Add a directory to the library search path. The
                        optional KIND can be one of
                        <dependency|crate|native|framework|all> (default:
                        all).
    -l [<KIND>[:<MODIFIERS>]=]<NAME>[:<RENAME>]
                        Link the generated crate(s) to the specified native
                        library NAME. The optional KIND can be one of
                        <static|framework|dylib> (default: dylib).
                        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|2024|future>
                        Specify which edition of the compiler to use when
                        compiling code. The default is 2015 and the latest
                        stable edition is 2024.
        --emit <TYPE>[=<FILE>]
                        Comma separated list of types of output for the
                        compiler to emit.
                        Each TYPE has the default FILE name:
                        * asm - CRATE_NAME.s
                        * llvm-bc - CRATE_NAME.bc
                        * dep-info - CRATE_NAME.d
                        * link - (platform and crate-type dependent)
                        * llvm-ir - CRATE_NAME.ll
                        * metadata - libCRATE_NAME.rmeta
                        * mir - CRATE_NAME.mir
                        * obj - CRATE_NAME.o
                        * thin-link-bitcode - CRATE_NAME.indexing.o
        --print <INFO>[=<FILE>]
                        Compiler information to print on stdout (or to a file)
                        INFO may be one of
                        <all-target-specs-json|backend-has-zstd|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deployment-target|file-names|host-tuple|link-args|native-static-libs|relocation-models|split-debuginfo|stack-protector-strategies|supported-crate-types|sysroot|target-cpus|target-features|target-libdir|target-list|target-spec-json|target-spec-json-schema|tls-models>.
    -g                  Equivalent to -C debuginfo=2
    -O                  Equivalent to -C opt-level=3
    -o <FILENAME>       Write output to FILENAME
        --out-dir <DIR> Write output to compiler-chosen filename in DIR
        --explain <OPT> Provide a detailed explanation of an error message
        --test          Build a test harness
        --target <TARGET>
                        Target tuple for which the code is compiled
    -A, --allow <LINT>  Set lint allowed
    -W, --warn <LINT>   Set lint warnings
        --force-warn <LINT>
                        Set lint force-warn
    -D, --deny <LINT>   Set lint denied
    -F, --forbid <LINT> Set lint forbidden
        --cap-lints <LEVEL>
                        Set the most restrictive lint level. More restrictive
                        lints are capped at this level
    -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
Options (31)
OptionDescriptionSource
-h, --helpDisplay the help message.help + man
--cfg SPECConfigure the compilation environment.help + man
--check-cfg SPECProvide list of expected cfgs for checkinghelp
-L KIND>=]<PATHAdd a directory to the library search path.help
-l KIND>[:<MODIFIERS>]=]<NAME>[:<RENAMELink the generated crate(s) to the specified native library NAME.help
--crate-typeComma separated list of types of crates for the compiler to emit.help + man
--crate-name NAMESpecify the name of the crate being built.help + man
--edition 2015|2018|2021|2024|futureSpecify which edition of the compiler to use when compiling code.help
--emit TYPE>[=<FILEComma separated list of types of output for the compiler to emit.help
--print INFO>[=<FILECompiler information to print on stdout (or to a file) INFO may be one of <all-target-specs-json|backend-has-zstd|calling-conventions|cfg|check-cfg|code-models|crate-name|crate-root-lint-levels|deploy…help
-gEquivalent to -C debuginfo=2.help + man
-OEquivalent to -C opt-level=2.help + man
-o FILENAMEWrite output to FILENAME.help + man
--testBuild a test harness.help + man
--target TARGETTarget tuple for which the code is compiled.help + man
-A, --allow LINTSet lint allowed.help + man
-W, --warn LINTPrint 'lint' options and default settings.help + man
--force-warn LINTSet lint force-warnhelp
-D, --deny LINTSet lint denied.help + man
--cap-lints LEVELSet the most restrictive lint level.help
-C, --codegen OPT>[=<VALUESet a codegen optionhelp
-V, --versionPrint version info and exit.help + man
-v, --verboseUse verbose output.help + man
--out-dir DIRWrite output to compiler‐chosen filename in DIR. (in the manual page but not in --help)man
--explain OPTProvide a detailed explanation of an error message. (in the manual page but not in --help)man
-F, --forbid OPTSet lint forbidden. (in the manual page but not in --help)man
--remap-path-prefix from=toRemap source path prefixes in all output, including compiler diagnostics, debug information, macro expansions, etc. (in the manual page but not in --help)man
--extern NAME=PATHSpecify where an external rust library is located. (in the manual page but not in --help)man
--sysroot PATHOverride the system root. (in the manual page but not in --help)man
-Z FLAGSet unstable / perma-unstable options. (in the manual page but not in --help)man
--color auto|always|neverConfigure coloring of output: (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.