diff --git a/crates/mdman/doc/out/mdman.md b/crates/mdman/doc/out/mdman.md index 8f6f1018c72..aefafa48bbd 100644 --- a/crates/mdman/doc/out/mdman.md +++ b/crates/mdman/doc/out/mdman.md @@ -54,7 +54,7 @@ man page:
-t typeSpecifies the output type. The following output types are supported:
man — A troff-style man page. Outputs with a numbered extension (like
.1) matching the man page section..md extension.
txt — A text file, rendered for situations where a man page viewer isn’t
available. Outputs with the .txt extension.-o outdirSpecifies the directory where to save the output.
+--url base_urlSpecifies a base URL to use for relative URLs within the document. Any +relative URL will be joined with this URL.
+--man name:section=url{{man name section}} expression is used, the given URL will be inserted as a link. This
+Specifies a URL to use for the given man page. When the {{man name section}} expression is used, the given URL will be inserted as a link. This
may be specified multiple times. If a man page reference does not have a
matching --man entry, then a relative link to a file named name.md will
-be used.
The source input filename, may be specified multiple times.
+--includeTesting an included link.
+--foo-barExample link. +See other-cmd(1), local-cmd(1)
+--foo-barDemo emphasis, strong, strike
-p spec--package specThis has multiple flags.
+A named argument.
+--complexThis option has a list.
+Then text continues here.
+@filenameLoad from filename.
+--foo [bar]Flag with optional value.
+--foo[=bar]Alternate syntax for optional value (with required = for disambiguation).
+--split-blockblock statement that is split across multiple linesAn option where the description has a block statement that is split across multiple lines
--git url--branch branchBranch to use when adding from git.
+--tag tagTag to use when adding from git.
+--rev shaSpecific commit to use when adding from git.
+--path pathFilesystem path to local crate to add.
+--base baseThe path base to use when adding a local crate.
+ +--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
--devAdd as a development dependency.
+--buildAdd as a build dependency.
+--target targetTo avoid unexpected shell expansions, you may use quotes around each target, e.g., --target 'cfg(unix)'.
Add as a dependency to the given target platform.
+To avoid unexpected shell expansions, you may use quotes around each target, e.g., --target 'cfg(unix)'.
registry.default config key which defaults
--dry-runDon’t actually write the manifest
+--rename nameRename the dependency.
+--optionalMark the dependency as optional.
+--no-optionalMark the dependency as required.
+--publicMark the dependency as public.
The dependency can be referenced in your library’s public API.
---no-publicMark the dependency as private.
While you can use the crate in your implementation, it cannot be referenced in your public API.
---no-default-featuresDisable the default features.
+--default-featuresRe-enable the default features.
+-F features--features featuresSpace or comma separated list of features to
activate. When adding multiple
crates, the features for a specific crate may be enabled with
package-name/feature-name syntax. This flag may be specified multiple times,
-which enables all specified features.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
-p spec--package specAdd dependencies to only the specified package.
+--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -214,15 +240,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -230,7 +258,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--no-runCompile, but don’t run benchmarks.
+--no-fail-fastRun all benchmarks regardless of failure. Without this flag, Cargo will exit after the first executable fails. The Rust test harness will run all benchmarks within the executable to completion, this flag only applies to the executable -as a whole.
-p spec…--package spec…Benchmark only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceBenchmark all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libBenchmark the package’s library.
+--bin name…Benchmark the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsBenchmark all binary targets.
+--example name…Benchmark the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesBenchmark all example targets.
+--test name…Benchmark the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Benchmark all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Benchmark the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Benchmark all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Benchmark all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleBenchmark for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
--profile nameBenchmark with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -289,7 +310,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -363,7 +389,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -402,15 +432,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -418,7 +450,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
-p spec…--package spec…Build only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceBuild all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libBuild the package’s library.
+--bin name…Build the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsBuild all binary targets.
+--example name…Build the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesBuild all example targets.
+--test name…Build the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Build all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Build the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Build all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Build all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleBuild for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Build optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameBuild with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -210,7 +230,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+--artifact-dir directoryCopy final artifacts to this directory.
This option is unstable and available only on the
nightly channel
and requires the -Z unstable-options flag to enable.
-See https://github.com/rust-lang/cargo/issues/6790 for more information.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -286,16 +312,18 @@ scheme. Cannot be used with human or short.human or short.
---build-planOutputs a series of JSON messages to stdout that indicate the commands to run the build.
This option is unstable and available only on the
nightly channel
and requires the -Z unstable-options flag to enable.
-See https://github.com/rust-lang/cargo/issues/5579 for more information.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -333,15 +364,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -349,7 +382,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo build -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo build -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
--future-incompat-reportDisplays a future-incompat report for any future-incompatible warnings produced during execution of this command
-See cargo-report(1)
See cargo-report(1)
+-p spec…--package spec…Check only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceCheck all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libCheck the package’s library.
+--bin name…Check the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsCheck all binary targets.
+--example name…Check the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesCheck all example targets.
+--test name…Check the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Check all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Check the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Check all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Check all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleCheck for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Check optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameCheck with the given profile.
As a special case, specifying the test profile will also enable checking in
test mode which will enable checking tests and enable the test cfg option.
See rustc tests for more
detail.
See the reference for more details on profiles.
See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -210,7 +230,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -277,7 +302,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -315,15 +344,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -331,7 +362,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo check -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo check -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
--future-incompat-reportDisplays a future-incompat report for any future-incompatible warnings produced during execution of this command
-See cargo-report(1)
See cargo-report(1)
+-p spec…--package spec…Clean only the specified packages. This flag may be specified +multiple times. See cargo-pkgid(1) for the SPEC format.
+--dry-run--verbose to display the actual files that would be deleted.Displays a summary of what would be deleted without deleting anything.
+Use with --verbose to display the actual files that would be deleted.
--doccargo clean to remove only the doc directory in
-the target directory.This option will cause cargo clean to remove only the doc directory in
+the target directory.
--releaserelease directory.Remove all artifacts in the release directory.
--profile nameRemove all artifacts in the directory with the given profile name.
+--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+--target tripleClean for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
target in the root of the workspace.This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -136,15 +148,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -152,7 +166,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--openOpen the docs in a browser after building them. This will use your default
browser unless you define another one in the BROWSER environment variable
or use the doc.browser configuration
-option.
--no-depsDo not build documentation for dependencies.
+--document-private-itemsInclude non-public items in the documentation. This will be enabled by default if documenting a binary target.
+-p spec…--package spec…Document only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceDocument all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libDocument the package’s library.
+--bin name…Document the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsDocument all binary targets.
+--example name…Document the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesDocument all example targets.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleDocument for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Document optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameDocument with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -187,7 +205,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -254,7 +277,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -292,15 +319,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -308,7 +337,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo doc -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo doc -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
--target tripleFetch for the specified target architecture. Flag may be specified multiple times. The default is all architectures. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index.
-May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -119,7 +127,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--broken-codecargo fix
+Fix code even if it already has compiler errors. This is useful if cargo fix
fails to apply the changes. It will apply the changes and leave the broken
-code in the working directory for you to inspect and manually fix.
--editionApply changes that will update the code to the next edition. This will not
update the edition in the Cargo.toml manifest, which must be updated
-manually after cargo fix --edition has finished.
cargo fix --edition has finished.
+--edition-idiomsApply suggestions that will update code to the preferred style for the current +edition.
+--allow-no-vcsFix code even if a VCS was not detected.
+--allow-dirtyFix code even if the working directory has changes (including staged changes).
+--allow-stagedFix code even if the working directory has staged changes.
+-p spec…--package spec…Fix only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceFix all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libFix the package’s library.
+--bin name…Fix the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsFix all binary targets.
+--example name…Fix the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesFix all example targets.
+--test name…Fix the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Fix all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Fix the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Fix all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Fix all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleFix for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Fix optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameFix with the given profile.
As a special case, specifying the test profile will also enable checking in
test mode which will enable checking tests and enable the test cfg option.
See rustc tests for more
detail.
See the reference for more details on profiles.
See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -290,7 +316,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -357,7 +388,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -395,15 +430,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -411,7 +448,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo fix -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo fix -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -84,15 +90,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -100,7 +108,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Fetch information about the specified package. The spec can be a package ID, see cargo-pkgid(1) for the SPEC
format.
If the specified package is part of the current workspace, information from the local Cargo.toml file will be displayed.
If the Cargo.lock file does not exist, it will be created. If no version is specified, the appropriate version will be
-selected based on the Minimum Supported Rust Version (MSRV).
--index indexThe URL of the registry index to use.
+--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -93,11 +100,13 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--binsrc/main.rs).
-This is the default behavior.Create a package with a binary target (src/main.rs).
+This is the default behavior.
--libsrc/lib.rs).Create a package with a library target (src/lib.rs).
--edition editionSpecify the Rust edition to use. Default is 2024. +Possible values: 2015, 2018, 2021, 2024
+--name nameSet the package name. Defaults to the directory name.
+--vcs vcsInitialize a new VCS repository for the given version control system (git,
hg, pijul, or fossil) or do not initialize any version control at all
(none). If not specified, defaults to git or the configuration value
-cargo-new.vcs, or none if already inside a VCS repository.
cargo-new.vcs, or none if already inside a VCS repository.
+--registry registrypublish field in Cargo.toml to the given registry name
+This sets the publish field in Cargo.toml to the given registry name
which will restrict publishing only to that registry.
Registry names are defined in Cargo config files.
If not specified, the default registry defined by the registry.default
config key is used. If the default registry is not set and --registry is not
used, the publish field will not be set which means that publishing will not
-be restricted.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--vers version--version versionSpecify a version to install. This may be a version
requirement, like ~1.2, to have Cargo
select the newest version from the given requirement. If the version does not
have a requirement operator (such as ^ or ~), then it must be in the form
MAJOR.MINOR.PATCH, and will install exactly that version; it is not
-treated as a caret requirement like Cargo dependencies are.
--git urlGit URL to install the specified crate from.
+--branch branchBranch to use when installing from git.
+--tag tagTag to use when installing from git.
+--rev shaSpecific commit to use when installing from git.
+--path pathFilesystem path to local crate to install from.
+--listList all installed packages and their versions.
+-n--dry-run(unstable) Perform all checks without installing.
+-f--forceForce overwriting existing crates or binaries. This can be used if a package
has installed a binary with the same name as another package. This is also
useful if something has changed on the system that you want to rebuild with,
-such as a newer version of rustc.
rustc.
+--no-trackBy default, Cargo keeps track of the installed packages with a metadata file
stored in the installation root directory. This flag tells Cargo not to use or
create that file. With this flag, Cargo will refuse to overwrite any existing
files unless the --force flag is used. This also disables Cargo’s ability to
protect against multiple concurrent invocations of Cargo installing at the
-same time.
--bin name…Install only the specified binary.
+--binsInstall all binaries. This is the default behavior.
+--example name…Install only the specified example.
+--examplesInstall all examples.
+--root dirDirectory to install packages into.
+--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+--index indexThe URL of the registry index to use.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleInstall for the specified target architecture. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
Defaults to a new temporary folder located in the
temporary directory of the platform.
When using --path, by default it will use target directory in the workspace
of the local crate unless --target-dir
-is specified.
--debugdev profile instead of the release profile.
-See also the --profile option for choosing a specific profile by name.Build with the dev profile instead of the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameInstall with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -261,7 +285,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -296,11 +323,13 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo install -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo install -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -377,7 +411,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--workspaceCargo.toml at the root of the workspace, as opposed to the current
-workspace member.Locate the Cargo.toml at the root of the workspace, as opposed to the current
+workspace member.
--message-format fmtThe representation in which to print the project location. Valid values:
json (default): JSON object with the path under the key “root”.plain: Just the path.-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--no-depsOutput information only about the workspace members and don’t fetch +dependencies.
+--format-version version1 is the only
-possible value.Specify the version of the output format to use. Currently 1 is the only
+possible value.
--filter-platform tripleresolve output to only include dependencies for the
+This filters the resolve output to only include dependencies for the
given target triple.
Without this flag, the resolve includes all targets.
Note that the dependencies listed in the “packages” array still includes all
dependencies. Each package definition is intended to be an unaltered
-reproduction of the information within Cargo.toml.
Cargo.toml.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -459,15 +470,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -475,7 +488,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--binsrc/main.rs).
-This is the default behavior.Create a package with a binary target (src/main.rs).
+This is the default behavior.
--libsrc/lib.rs).Create a package with a library target (src/lib.rs).
--edition editionSpecify the Rust edition to use. Default is 2024. +Possible values: 2015, 2018, 2021, 2024
+--name nameSet the package name. Defaults to the directory name.
+--vcs vcsInitialize a new VCS repository for the given version control system (git,
hg, pijul, or fossil) or do not initialize any version control at all
(none). If not specified, defaults to git or the configuration value
-cargo-new.vcs, or none if already inside a VCS repository.
cargo-new.vcs, or none if already inside a VCS repository.
+--registry registrypublish field in Cargo.toml to the given registry name
+This sets the publish field in Cargo.toml to the given registry name
which will restrict publishing only to that registry.
Registry names are defined in Cargo config files.
If not specified, the default registry defined by the registry.default
config key is used. If the default registry is not set and --registry is not
used, the publish field will not be set which means that publishing will not
-be restricted.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-a--add login…Invite the given user or team as an owner.
+-r--remove login…Remove the given user or team as an owner.
+-l--listList owners of a crate.
+--token tokenAPI token to use when authenticating. This overrides the token stored in the credentials file (which is created by cargo-login(1)).
Cargo config environment variables can be
used to override the tokens stored in the credentials file. The token for
crates.io may be specified with the CARGO_REGISTRY_TOKEN environment
variable. Tokens for other registries may be specified with environment
variables of the form CARGO_REGISTRIES_NAME_TOKEN where NAME is the name
-of the registry in all capital letters.
--index indexThe URL of the registry index to use.
+--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-l--listPrint files included in a package without making one.
+--no-verifyDon’t verify the contents by building them.
+--no-metadataIgnore warnings about a lack of human-usable metadata (such as the description +or the license).
+--allow-dirtyAllow working directories with uncommitted VCS changes to be packaged.
+--exclude-lockfileDon’t include the lock file when packaging.
This flag is not for general use.
Some tools may expect a lock file to be present (e.g. cargo install --locked).
-Consider other options before using this.
--index indexThe URL of the registry index to use.
+--registry registrycargo publish --help for more details
+Name of the registry to package for; see cargo publish --help for more details
about configuration of registry names. The packages will not be published
to this registry, but if we are packaging multiple inter-dependent crates,
lock-files will be generated under the assumption that dependencies will be
-published to this registry.
--message-format fmtSpecifies the output message format.
Currently, it only works with --list and affects the file listing format.
This is unstable and requires -Zunstable-options.
Valid output formats:
-p spec…--package spec…Package only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspacePackage all members in the workspace.
+--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--target triplePackage for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -284,15 +302,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -300,7 +320,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo package -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo package -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-p spec--package specGet the package ID for the given package instead of the current package.
+-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -112,15 +118,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -128,7 +136,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--dry-runPerform all checks without uploading.
+--no-verifyDon’t verify the contents by building them.
+--allow-dirtyAllow working directories with uncommitted VCS changes to be packaged.
+--index indexThe URL of the registry index to use.
+--registry registryName of the registry to publish to. Registry names are defined in Cargo
config files. If not specified, and there is a
package.publish field in
Cargo.toml with a single registry, then it will publish to that registry.
Otherwise it will use the default registry, which is defined by the
registry.default config key
-which defaults to crates-io.
crates-io.
+-p spec…--package spec…Publish only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspacePublish all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--target triplePublish for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -194,15 +210,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -210,7 +228,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo publish -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo publish -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--devRemove as a development dependency.
+--buildRemove as a build dependency.
+--target targetTo avoid unexpected shell expansions, you may use quotes around each target, e.g., --target 'cfg(unix)'.
Remove as a dependency to the given target platform.
+To avoid unexpected shell expansions, you may use quotes around each target, e.g., --target 'cfg(unix)'.
--dry-runDon’t actually write to the manifest.
+-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -103,15 +112,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -119,7 +130,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
-p spec…--package spec…Package to remove from.
+-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--id idShow the report with the specified Cargo-generated id
+-p spec…--package spec…Only display a report for the specified package
+-p spec--package specThe package to run. See cargo-pkgid(1) for the SPEC +format.
+--bin nameRun the specified binary.
+--example nameRun the specified example.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleRun for the specified target architecture. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Run optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameRun with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -127,7 +136,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -195,7 +209,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -235,15 +253,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -251,7 +271,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo run -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo run -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
-p spec--package specThe package to build. See cargo-pkgid(1) for the SPEC +format.
+--libBuild the package’s library.
+--bin name…Build the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsBuild all binary targets.
+--example name…Build the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesBuild all example targets.
+--test name…Build the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Build all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Build the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Build all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Build all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleBuild for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Build optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameBuild with the given profile.
The rustc subcommand will treat the following named profiles with special behaviors:
check — Builds in the same way as the cargo-check(1) command with
@@ -193,11 +209,12 @@ tests for more detail.bench — Builds in the same was as the cargo-bench(1) command,
similar to the test profile.See the reference for more details on profiles.
See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -210,19 +227,21 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--crate-type crate-typeBuild for the given crate type. This flag accepts a comma-separated list of
1 or more crate types, of which the allowed values are the same as crate-type
field in the manifest for configuring a Cargo target. See
crate-type field
for possible values.
If the manifest contains a list, and --crate-type is provided,
the command-line argument value will override what is in the manifest.
This flag only works when building a lib or example library target.
This flag only works when building a lib or example library target.
--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -289,7 +312,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -329,15 +356,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -345,7 +374,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo rustc -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo rustc -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
--future-incompat-reportDisplays a future-incompat report for any future-incompatible warnings produced during execution of this command
-See cargo-report(1)
See cargo-report(1)
+--openOpen the docs in a browser after building them. This will use your default
browser unless you define another one in the BROWSER environment variable
or use the doc.browser configuration
-option.
-p spec--package specThe package to document. See cargo-pkgid(1) for the SPEC +format.
+--libDocument the package’s library.
+--bin name…Document the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsDocument all binary targets.
+--example name…Document the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesDocument all example targets.
+--test name…Document the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Document all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Document the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Document all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Document all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleDocument for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Document optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameDocument with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -205,7 +223,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+target in the root of the workspace.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -272,7 +295,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -310,15 +337,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -326,7 +355,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-Z unstable-options flag to enable (see
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--keep-goingBuild as many crates in the dependency graph as possible, rather than aborting the build on the first one that fails to build.
For example if the current package depends on dependencies fails and works,
one of which fails to build, cargo rustdoc -j1 may or may not build the
one that succeeds (depending on which one of the two builds Cargo picked to run
first), whereas cargo rustdoc -j1 --keep-going would definitely run both
-builds, even if the one run first fails.
--output-formatThe output type for the documentation emitted. Valid values:
html (default): Emit the documentation in HTML format.json: Emit the documentation in the experimental JSON format.This option is only available on the nightly channel
-and requires the -Z unstable-options flag to enable.
-Z unstable-options flag to enable.
+--limit limitLimit the number of results (default: 10, max: 100).
+--index indexThe URL of the registry index to use.
+--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
--no-runCompile, but don’t run tests.
+--no-fail-fastRun all tests regardless of failure. Without this flag, Cargo will exit after the first executable fails. The Rust test harness will run all tests within the executable to completion, this flag only applies to the executable -as a whole.
-p spec…--package spec…Test only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceTest all members in the workspace.
+--all--workspace.Deprecated alias for --workspace.
--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--libTest the package’s library.
+--bin name…Test the specified binary. This flag may be specified multiple times +and supports common Unix glob patterns.
+--binsTest all binary targets.
+--example name…Test the specified example. This flag may be specified multiple times +and supports common Unix glob patterns.
+--examplesTest all example targets.
+--test name…Test the specified integration test. This flag may be specified +multiple times and supports common Unix glob patterns.
+--teststest = true manifest
+Test all targets that have the test = true manifest
flag set. By default this includes the library and binaries built as
unittests, and integration tests. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
unittest, and once as a dependency for binaries, integration tests, etc.).
Targets may be enabled or disabled by setting the test flag in the
-manifest settings for the target.
--bench name…Test the specified benchmark. This flag may be specified multiple +times and supports common Unix glob patterns.
+--benchesbench = true
+Test all targets that have the bench = true
manifest flag set. By default this includes the library and binaries built
as benchmarks, and bench targets. Be aware that this will also build any
required dependencies, so the lib target may be built twice (once as a
benchmark, and once as a dependency for binaries, benchmarks, etc.).
Targets may be enabled or disabled by setting the bench flag in the
-manifest settings for the target.
--all-targets--lib --bins --tests --benches --examples.Test all targets. This is equivalent to specifying --lib --bins --tests --benches --examples.
--docTest only the library’s documentation. This cannot be mixed with other +target options.
+-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
--target tripleTest for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
This may also be specified with the build.target config value.
Note that specifying this flag makes Cargo run in a different mode where the target artifacts are placed in a separate directory. See the -build cache documentation for more details.
-r--releaserelease profile.
-See also the --profile option for choosing a specific profile by name.Test optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profile nameTest with the given profile. +See the reference for more details on profiles.
+--timings=fmtsOutput information how long each compilation takes, and track concurrency
information over time. Accepts an optional comma-separated list of output
formats; --timings without an argument will default to --timings=html.
Specifying an output format (rather than the default) is unstable and requires
@@ -317,7 +340,8 @@ to look at older runs. HTML output is suitable for human consumption only,
and does not provide machine-readable timing data.
json (unstable, requires -Zunstable-options): Emit machine-readable JSON
information about timing information.--target-dir directoryDirectory for all generated artifacts and intermediate files. May also be
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dir config value.
-Defaults to target in the root of the workspace.
target in the root of the workspace.
+-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--message-format fmtThe output format for diagnostic messages. Can be specified multiple times and consists of comma-separated values. Valid values:
human (default): Display in a human-readable text format. Conflicts with
@@ -391,7 +419,8 @@ scheme. Cannot be used with human or short.human or short.
-human or <
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -431,15 +463,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -447,7 +481,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-j N--jobs NNumber of parallel jobs to run. May also be specified with the
build.jobs config value. Defaults to
the number of logical CPUs. If negative, it sets the maximum number of
parallel jobs to the number of logical CPUs plus provided value. If
a string default is provided, it sets the value back to defaults.
-Should not be 0.
--future-incompat-reportDisplays a future-incompat report for any future-incompatible warnings produced during execution of this command
-See cargo-report(1)
See cargo-report(1)
+-i spec--invert specShow the reverse dependencies for the given package. This flag will invert the tree and display the packages that depend on the given package.
Note that in a workspace, by default it will only display the package’s
reverse dependencies inside the tree of the workspace member in the current
directory. The --workspace flag can be used to extend it so that it will
show the package’s reverse dependencies across the entire workspace. The -p
flag can be used to display the package’s reverse dependencies only with the
-subtree of the package given to -p.
-p.
+--prune specPrune the given package from the display of the dependency tree.
+--depth depthMaximum display depth of the dependency tree. A depth of 1 displays the direct dependencies, for example.
If the given value is workspace, only shows the dependencies that are member
-of the current workspace, instead.
--no-dedupeDo not de-duplicate repeated dependencies. Usually, when a package has already
displayed its dependencies, further occurrences will not re-display its
dependencies, and will include a (*) to indicate it has already been shown.
-This flag will cause those duplicates to be repeated.
-d--duplicates--invert).
+Show only dependencies which come in multiple versions (implies --invert).
When used with the -p flag, only shows duplicates within the subtree of the
given package.
It can be beneficial for build times and executable sizes to avoid building that same package multiple times. This flag can help identify the offending packages. You can then investigate if the package that depends on the duplicate with the older version can be updated to the newer version so that -only one instance is built.
-e kinds--edges kindsThe dependency kinds to display. Takes a comma separated list of values:
all — Show all edge kinds.normal — Show normal dependencies.The normal, build, dev, and all dependency kinds cannot be mixed with
no-normal, no-build, or no-dev dependency kinds.
The default is normal,build,dev.
The default is normal,build,dev.
--target tripleall to include all targets.Filter dependencies matching the given target triple.
+The default is the host platform. Use the value all to include all targets.
all to include
--charset charsetChooses the character set to use for the tree. Valid values are “utf8” or +“ascii”. When unspecified, cargo will auto-select a value.
+-f format--format formatSet the format string for each package. The default is “{p}”.
This is an arbitrary string which will be used to display each package. The following strings will be replaced with the corresponding value:
{r} — The package repository URL.{f} — Comma-separated list of package features that are enabled.{lib} — The name, as used in a use statement, of the package’s library.--prefix prefixSets how each line is displayed. The prefix value can be one of:
indent (default) — Shows each line indented as a tree.depth — Show as a list, with the numeric depth printed before each entry.none — Show as a flat list.-p spec…--package spec…Display only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
-double quotes around each pattern.
--workspaceDisplay all members in the workspace.
+--exclude SPEC…Exclude the specified packages. Must be used in conjunction with the
--workspace flag. This flag may be specified multiple times and supports
common Unix glob patterns like *, ? and []. However, to avoid your shell
accidentally expanding glob patterns before Cargo handles them, you must use
-single quotes or double quotes around each pattern.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -246,15 +261,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -262,7 +279,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-F features--features featuresSpace or comma separated list of features to activate. Features of workspace
members may be enabled with package-name/feature-name syntax. This flag may
-be specified multiple times, which enables all specified features.
--all-featuresActivate all available features of all selected packages.
+--no-default-featuresdefault feature of the selected packages.Do not activate the default feature of the selected packages.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-p--package spec…Package to uninstall.
+--bin name…Only uninstall the binary name.
+--root dirDirectory to uninstall packages from.
+-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
Update only the specified packages. This flag may be specified multiple times. See cargo-pkgid(1) for the SPEC format.
If packages are specified with spec, then a conservative update of the lockfile will be performed. This means that only the dependency specified by SPEC will be updated. Its transitive dependencies will be updated only if SPEC cannot be updated without updating dependencies. All other dependencies will remain locked at their currently recorded versions.
-If spec is not specified, all dependencies are updated.
If spec is not specified, all dependencies are updated.
+--recursive--precise.When used with spec, dependencies of spec are forced to update as well.
+Cannot be used with --precise.
--precise preciseWhen used with spec, allows you to specify a specific version number to set the package to. If the package comes from a git repository, this can be a git revision (such as a SHA hash or tag).
While not recommended, you can specify a yanked version of a package. When possible, try other non-yanked SemVer-compatible versions or seek help from the maintainers of the package.
A compatible pre-release version can also be specified even when the version
-requirement in Cargo.toml doesn’t contain any pre-release identifier (nightly only).
Cargo.toml doesn’t contain any pre-release identifier (nightly only).
+--breaking directoryUpdate spec to latest SemVer-breaking version.
Version requirements will be modified to allow this update.
This only applies to dependencies when
Cargo.toml doesn’t contain any pre-release identif
This option is unstable and available only on the
nightly channel
and requires the -Z unstable-options flag to enable.
-See https://github.com/rust-lang/cargo/issues/12425 for more information.
-w--workspaceAttempt to update only packages defined in the workspace. Other packages
are updated only if they don’t already exist in the lockfile. This
option is useful for updating Cargo.lock after you’ve changed version
-numbers in Cargo.toml.
Cargo.toml.
+--dry-runDisplays what would be updated, but doesn’t actually write the lockfile.
+Cargo.toml.
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--ignore-rust-versionrust-version specification in packages.Ignore rust-version specification in packages.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -143,15 +155,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -159,7 +173,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-s manifest--sync manifestCargo.toml manifest to workspaces which should also be
-vendored and synced to the output. May be specified multiple times.Specify an extra Cargo.toml manifest to workspaces which should also be
+vendored and synced to the output. May be specified multiple times.
--no-deleteDon’t delete the “vendor” directory when vendoring, but rather keep all +existing contents of the vendor directory
+--respect-source-config[source] configuration by default in .cargo/config.toml
-read it and use it when downloading crates from crates.io, for exampleInstead of ignoring [source] configuration by default in .cargo/config.toml
+read it and use it when downloading crates from crates.io, for example
--versioned-dirsNormally versions are only added to disambiguate multiple versions of the same package. This option causes all directories in the “vendor” directory to be versioned, which makes it easier to track the history of vendored packages over time, and can help with the performance of re-vendoring when -only a subset of the packages have changed.
--manifest-path pathCargo.toml file. By default, Cargo searches for the
-Cargo.toml file in the current directory or any parent directory.Path to the Cargo.toml file. By default, Cargo searches for the
+Cargo.toml file in the current directory or any parent directory.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -90,15 +96,17 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
--lockfile-path PATH<workspace_root>/Cargo.lock) to PATH. PATH must end with
+Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with
Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing
--lockfile-path will ignore existing lockfile at the default path, and instead will
either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist.
@@ -106,7 +114,8 @@ This flag can be used to run most commands in read-only directories, writing loc
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#14421).
-Z unstable-options flag to enable (see
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-v--verboseDisplay additional version information.
+--vers version--version versionThe version to yank or un-yank.
+--undoUndo a yank, putting a version back into the index.
+--token tokenAPI token to use when authenticating. This overrides the token stored in the credentials file (which is created by cargo-login(1)).
Cargo config environment variables can be
used to override the tokens stored in the credentials file. The token for
crates.io may be specified with the CARGO_REGISTRY_TOKEN environment
variable. Tokens for other registries may be specified with environment
variables of the form CARGO_REGISTRIES_NAME_TOKEN where NAME is the name
-of the registry in all capital letters.
--index indexThe URL of the registry index to use.
+--registry registryName of the registry to use. Registry names are defined in Cargo config
files. If not specified, the default registry is used,
which is defined by the registry.default config key which defaults to
-crates-io.
crates-io.
+registry.default config key which defaults
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
-V--version--verbose, prints extra
-information.Print version info and exit. If used with --verbose, prints extra
+information.
--list--verbose, prints extra
-information.List all installed Cargo subcommands. If used with --verbose, prints extra
+information.
--explain coderustc --explain CODE which will print out a detailed explanation of an
-error message (for example, E0004).Run rustc --explain CODE which will print out a detailed explanation of an
+error message (for example, E0004).
E0004).
-v--verboseUse verbose output. May be specified twice for “very verbose” output which
includes extra output such as dependency warnings and build script output.
May also be specified with the term.verbose
-config value.
-q--quietDo not print cargo log messages.
May also be specified with the term.quiet
-config value.
--color whenControl when colored output is used. Valid values:
auto (default): Automatically detect if color support is available on the
terminal.never: Never display colors.May also be specified with the term.color
-config value.
--lockedAsserts that the exact same dependencies and versions are used as when the
existing Cargo.lock file was originally generated. Cargo will exit with an
error when either of the following scenarios arises:
It may be used in environments where deterministic builds are desired, -such as in CI pipelines.
--offlinePrevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible.
@@ -213,11 +220,13 @@ mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. -May also be specified with the net.offline config value.
May also be specified with the net.offline config value.
--frozen--locked and --offline.Equivalent to specifying both --locked and --offline.
+toolchaincargo
+If Cargo has been installed with rustup, and the first argument to cargo
begins with +, it will be interpreted as a rustup toolchain name (such
as +stable or +nightly).
See the rustup documentation
-for more information about how toolchain overrides work.
--config KEY=VALUE or PATHKEY=VALUE,
+Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE,
or provided as a path to an extra configuration file. This flag may be specified multiple times.
-See the command-line overrides section for more information.
-C PATHChanges the current working directory before executing any specified operations. This affects
things like where cargo looks by default for the project manifest (Cargo.toml), as well as
the directories searched for discovering .cargo/config.toml, for example. This option must
appear before the command name, for example cargo -C path/to/my-project build.
This option is only available on the nightly
channel and
requires the -Z unstable-options flag to enable (see
-#10098).
-h--helpPrints help information.
+-Z flagcargo -Z help for details.Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.