OS Manuals

/usr/bin/rustdoc

Empowering everyone to build reliable and efficient software.

From rust-1.93 1.93.1-r16 (enterprise-packages), captured 2026-11-08 by running rustdoc --help (exit 0). permalink

rustdoc [options] <input>

Options:
    -h, --help          show this help message
    -V, --version       print rustdoc's version
    -v, --verbose       use verbose output
    -w, --output-format [html]
                        the output type to write
        --output PATH   Which directory to place the output. This option is
                        deprecated, use --out-dir instead.
    -o, --out-dir PATH  which directory to place the output
        --crate-name NAME
                        specify the name of this crate
        --crate-type <bin|lib|rlib|dylib|cdylib|staticlib|proc-macro>
                        Comma separated list of types of crates
                        for the compiler to emit
    -L, --library-path DIR
                        directory to add to crate search path
        --cfg           pass a --cfg to rustc
        --check-cfg     pass a --check-cfg to rustc
        --extern NAME[=PATH]
                        pass an --extern to rustc
        --extern-html-root-url NAME=URL
                        base URL to use for dependencies; for example,
                        "std=/doc" links std::vec::Vec to
                        /doc/std/vec/struct.Vec.html
        --extern-html-root-takes-precedence
                        give precedence to `--extern-html-root-url`, not
                        `html_root_url`
    -C, --codegen OPT[=VALUE]
                        pass a codegen option to rustc
        --document-private-items
                        document private items
        --document-hidden-items
                        document items that have doc(hidden)
        --test          run code examples as tests
        --test-args ARGS
                        arguments to pass to the test runner
        --test-run-directory PATH
                        The working directory in which to run tests
        --target TRIPLE target triple to document
        --markdown-css FILES
                        CSS files to include via <link> in a rendered Markdown
                        file
        --html-in-header FILES
                        files to include inline in the <head> section of a
                        rendered Markdown file or generated documentation
        --html-before-content FILES
                        files to include inline between <body> and the content
                        of a rendered Markdown file or generated documentation
        --html-after-content FILES
                        files to include inline between the content and
                        </body> of a rendered Markdown file or generated
                        documentation
        --markdown-before-content FILES
                        files to include inline between <body> and the content
                        of a rendered Markdown file or generated documentation
        --markdown-after-content FILES
                        files to include inline between the content and
                        </body> of a rendered Markdown file or generated
                        documentation
        --markdown-playground-url URL
                        URL to send code snippets to
        --markdown-no-toc
                        don't include table of contents
    -e, --extend-css PATH
                        To add some CSS rules with a given file to generate
                        doc with your own theme. However, your theme might
                        break if the rustdoc's generated HTML changes, so be
                        careful!
    -Z FLAG             unstable / perma-unstable options (only on nightly
                        build)
        --sysroot PATH  Override the system root
        --playground-url URL
                        URL to send code snippets to, may be reset by
                        --markdown-playground-url or
                        `#![doc(html_playground_url=...)]`
        --display-doctest-warnings
                        show warnings that originate in doctests
        --crate-version VERSION
                        crate version to print into documentation
        --sort-modules-by-appearance
                        sort modules by where they appear in the program,
                        rather than alphabetically
        --default-theme THEME
                        Set the default theme. THEME should be the theme name,
                        generally lowercase. If an unknown default theme is
                        specified, the builtin default is used. The set of
                        themes, and the rustdoc built-in default, are not
                        stable.
        --default-setting SETTING[=VALUE]
                        Default value for a rustdoc setting (used when
                        "rustdoc-SETTING" is absent from web browser Local
                        Storage). If VALUE is not supplied, "true" is used.
                        Supported SETTINGs and VALUEs are not documented and
                        not stable.
        --theme FILES   additional themes which will be added to the generated
                        docs
        --check-theme FILES
                        check if given theme is valid
        --resource-suffix PATH
                        suffix to add to CSS and JavaScript files, e.g.,
                        "search-index.js" will become "search-index-suffix.js"
        --edition EDITION
                        edition to use when compiling rust code (default:
                        2015)
        --color auto|always|never
                        Configure coloring of output:
                        auto = colorize, if output goes to a tty (default);
                        always = always colorize output;
                        never = never colorize output
        --error-format human|json|short
                        How errors and other messages are produced
        --diagnostic-width WIDTH
                        Provide width of the output for truncated error
                        messages
        --json CONFIG   Configure the structure of JSON diagnostics
    -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. By default, it is at
                        `forbid` level.
        --index-page PATH
                        Markdown file to be used as index page
        --enable-index-page
                        To enable generation of the index page
        --static-root-path PATH
                        Path string to force loading static files from in
                        output pages. If not set, uses combinations of '../'
                        to reach the documentation root.
        --persist-doctests PATH
                        Directory to persist doctest executables into
        --show-coverage
                        calculate percentage of public items with
                        documentation
        --test-runtool The tool to run tests with when building for a different target than host

        --test-runtool-arg One argument (of possibly many) to pass to the runtool

        --test-builder PATH
                        The rustc-like binary to use as the test builder
        --test-builder-wrapper PATH
                        Wrapper program to pass test-builder and arguments
        --check         Run rustdoc checks
        --generate-redirect-map
                        Generate JSON file at the top level instead of
                        generating HTML redirection files
        --emit [toolchain-shared-resources,invocation-specific,dep-info]
                        Comma separated list of types of output for rustdoc to
                        emit
        --no-run        Compile doctests without running them
        --remap-path-prefix FROM=TO
                        Remap source names in compiler messages
        --show-type-layout
                        Include the memory layout of types in the docs
        --no-capture    Don't capture stdout and stderr of tests
        --generate-link-to-definition
                        Make the identifiers in the HTML source code pages
                        navigable
        --scrape-examples-output-path collect function call information and output at the given path

        --scrape-examples-target-crate collect function call information for functions from the target crate

        --scrape-tests  Include test code when scraping examples
        --with-examples path to function call information (for displaying examples in the documentation)

        --merge none|shared|finalize
                        Controls how rustdoc handles files from previously
                        documented crates in the doc root
                        none = Do not write cross-crate information to the
                        --out-dir
                        shared = Append current crate's info to files found in
                        the --out-dir
                        finalize = Write current crate's info and
                        --include-parts-dir info to the --out-dir, overwriting
                        conflicting files
        --parts-out-dir path/to/doc.parts/<crate-name>
                        Writes trait implementations and other info for the
                        current crate to provided path. Only use with
                        --merge=none
        --include-parts-dir path/to/doc.parts/<crate-name>
                        Includes trait implementations and other crate info
                        from provided path. Only use with --merge=finalize
        --html-no-source
                        Disable HTML source code pages generation
        --doctest-build-arg ARG
                        One argument (of possibly many) to be used when
                        compiling doctests
        --disable-minification
                        disable the minification of CSS/JS files
                        (perma-unstable, do not use with cached files)
        --generate-macro-expansion
                        Add possibility to expand macros in the HTML source
                        code pages
        --plugin-path DIR
                        removed, see issue #44136
                        <https://github.com/rust-lang/rust/issues/44136> for
                        more information
        --passes PASSES removed, see issue #44136
                        <https://github.com/rust-lang/rust/issues/44136> for
                        more information
        --plugins PLUGINS
                        removed, see issue #44136
                        <https://github.com/rust-lang/rust/issues/44136> for
                        more information
        --no-defaults   removed, see issue #44136
                        <https://github.com/rust-lang/rust/issues/44136> for
                        more information
    -r, --input-format [rust]
                        removed, see issue #44136
                        <https://github.com/rust-lang/rust/issues/44136> for
                        more information

    @path               Read newline separated options from `path`

More information available at https://doc.rust-lang.org/1.93.1/rustdoc/what-is-rustdoc.html
Options (78)
OptionDescriptionSource
-h, --helpshow this help messagehelp
-V, --versionprint rustdoc's versionhelp
-v, --verboseuse verbose outputhelp
-w, --output-format htmlthe output type to writehelp
--output PATHWhich directory to place the output.help
-o, --out-dir PATHwhich directory to place the outputhelp
--crate-name NAMEspecify the name of this cratehelp
--crate-typeComma separated list of types of crates for the compiler to emithelp
-L, --library-path DIRdirectory to add to crate search pathhelp
--cfgpass a --cfg to rustchelp
--check-cfgpass a --check-cfg to rustchelp
--extern NAME[=PATHpass an --extern to rustchelp
--extern-html-root-url NAME=URLbase URL to use for dependencies;help
--extern-html-root-takes-precedencegive precedence to `--extern-html-root-url`, not `html_root_url`help
-C, --codegen OPT[=VALUEpass a codegen option to rustchelp
--document-private-itemsdocument private itemshelp
--document-hidden-itemsdocument items that have doc(hidden)help
--testrun code examples as testshelp
--test-args ARGSarguments to pass to the test runnerhelp
--test-run-directory PATHThe working directory in which to run testshelp
--markdown-css FILESCSS files to include via <link> in a rendered Markdown filehelp
--html-in-header FILESfiles to include inline in the <head> section of a rendered Markdown file or generated documentationhelp
--html-before-content FILESfiles to include inline between <body> and the content of a rendered Markdown file or generated documentationhelp
--html-after-content FILESfiles to include inline between the content and </body> of a rendered Markdown file or generated documentationhelp
--markdown-before-content FILESfiles to include inline between <body> and the content of a rendered Markdown file or generated documentationhelp
--markdown-after-content FILESfiles to include inline between the content and </body> of a rendered Markdown file or generated documentationhelp
--markdown-playground-url URLURL to send code snippets tohelp
--markdown-no-tocdon't include table of contentshelp
-e, --extend-css PATHTo add some CSS rules with a given file to generate doc with your own theme.help
-Z FLAGunstable / perma-unstable options (only on nightly build)help
--sysroot PATHOverride the system roothelp
--playground-url URLURL to send code snippets to, may be reset byhelp
--display-doctest-warningsshow warnings that originate in doctestshelp
--crate-version VERSIONcrate version to print into documentationhelp
--sort-modules-by-appearancesort modules by where they appear in the program, rather than alphabeticallyhelp
--default-theme THEMESet the default theme.help
--default-setting SETTING[=VALUEDefault value for a rustdoc setting (used when "rustdoc-SETTING" is absent from web browser Local Storage).help
--theme FILESadditional themes which will be added to the generated docshelp
--check-theme FILEScheck if given theme is validhelp
--resource-suffix PATHsuffix to add to CSS and JavaScript files, e.g., "search-index.js" will become "search-index-suffix.js"help
--edition EDITIONedition to use when compiling rust code (default: 2015)help
--color auto|always|neverConfigure coloring of output: auto = colorize, if output goes to a tty (default);help
--error-format human|json|shortHow errors and other messages are producedhelp
--diagnostic-width WIDTHProvide width of the output for truncated error messageshelp
--json CONFIGConfigure the structure of JSON diagnosticshelp
-A, --allow LINTSet lint allowedhelp
-W, --warn LINTSet lint warningshelp
--force-warn LINTSet lint force-warnhelp
-D, --deny LINTSet lint deniedhelp
-F, --forbid LINTSet lint forbiddenhelp
--cap-lints LEVELSet the most restrictive lint level.help
--index-page PATHMarkdown file to be used as index pagehelp
--enable-index-pageTo enable generation of the index pagehelp
--static-root-path PATHPath string to force loading static files from in output pages.help
--persist-doctests PATHDirectory to persist doctest executables intohelp
--show-coveragecalculate percentage of public items with documentationhelp
--test-builder PATHThe rustc-like binary to use as the test builderhelp
--test-builder-wrapper PATHWrapper program to pass test-builder and argumentshelp
--checkRun rustdoc checkshelp
--generate-redirect-mapGenerate JSON file at the top level instead of generating HTML redirection fileshelp
--emit toolchain-shared-resourcesComma separated list of types of output for rustdoc to emithelp
--no-runCompile doctests without running themhelp
--remap-path-prefix FROM=TORemap source names in compiler messageshelp
--show-type-layoutInclude the memory layout of types in the docshelp
--no-captureDon't capture stdout and stderr of testshelp
--generate-link-to-definitionMake the identifiers in the HTML source code pages navigablehelp
--scrape-testsInclude test code when scraping exampleshelp
--merge none|shared|finalizeControls how rustdoc handles files from previously documented crates in the doc root none = Do not write cross-crate information to thehelp
--parts-out-dir path/to/doc.parts/<crate-nameWrites trait implementations and other info for the current crate to provided path.help
--include-parts-dir path/to/doc.parts/<crate-nameIncludes trait implementations and other crate info from provided path.help
--html-no-sourceDisable HTML source code pages generationhelp
--doctest-build-arg ARGOne argument (of possibly many) to be used when compiling doctestshelp
--disable-minificationdisable the minification of CSS/JS files (perma-unstable, do not use with cached files)help
--generate-macro-expansionAdd possibility to expand macros in the HTML source code pageshelp
--plugin-path DIRremoved, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more informationhelp
--plugins PLUGINSremoved, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more informationhelp
--no-defaultsremoved, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more informationhelp
-r, --input-format rustremoved, see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more informationhelp

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