Auto merge of #6405 - ehuss:new-man, r=alexcrichton

New man pages.

This is a rewrite and update of the man pages. This also adds them to the website documentation. They are now in Asciidoc format to make it easy to output multiple formats and have decent formatting. There is a Makefile with instructions on how to rebuild the man pages.

Closes #5729.
This commit is contained in:
bors 2018-12-17 18:13:06 +00:00
commit bd5b21e997
155 changed files with 21760 additions and 2030 deletions

28
src/doc/Makefile Normal file
View File

@ -0,0 +1,28 @@
# This Makefile is used to build the Cargo man pages.
#
# The source for the man pages are located in src/doc/man in Asciidoctor
# format. See https://asciidoctor.org/ for more information.
#
# Just run `make` and it will generate the man pages in src/etc/man and the
# HTML pages in src/doc/src/commands/generated.
#
# There are some Asciidoctor extensions, see the file `asciidoc-extensions.rb`
# for the documentation.
MAN_SOURCE = $(sort $(wildcard man/cargo*.adoc))
COMMANDS = $(notdir $(MAN_SOURCE))
HTML = $(patsubst %.adoc,src/commands/generated/%.html,$(COMMANDS))
MAN_LOCATION = ../etc/man
MAN = $(patsubst %.adoc,$(MAN_LOCATION)/%.1,$(COMMANDS))
ASCIIDOCOPTS = -r ./asciidoc-extension.rb
OTHER_DEPS = asciidoc-extension.rb $(filter-out $(MAN_SOURCE),$(sort $(wildcard man/*.adoc)))
all: commands-html man
commands-html: $(HTML)
man: $(MAN)
$(HTML): src/commands/generated/%.html : man/%.adoc asciidoc-extension.rb $(OTHER_DEPS)
asciidoctor $(ASCIIDOCOPTS) -s $< -o $@
$(MAN): $(MAN_LOCATION)/%.1 : man/%.adoc $(OTHER_DEPS)
asciidoctor $(ASCIIDOCOPTS) -b manpage $< -o $@

View File

@ -0,0 +1,109 @@
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include Asciidoctor
# An inline macro that generates links to related man pages.
#
# Usage
#
# man:gittutorial[7]
#
class ManInlineMacro < Extensions::InlineMacroProcessor
use_dsl
named :man
name_positional_attributes 'volnum'
def process parent, target, attrs
manname = target
suffix = if (volnum = attrs['volnum'])
"(#{volnum})"
else
nil
end
text = %(#{manname}#{suffix})
if parent.document.basebackend? 'html'
parent.document.register :links, target
if manname == 'rustc'
html_target = 'https://doc.rust-lang.org/rustc/index.html'
elsif manname == 'rustdoc'
html_target = 'https://doc.rust-lang.org/rustdoc/index.html'
elsif manname == 'cargo'
html_target = 'commands/index.html'
else
html_target = %(commands/#{manname}.html)
end
%(#{(create_anchor parent, text, type: :link, target: html_target).render})
elsif parent.document.backend == 'manpage'
%(\x1b\\fB#{manname}\x1b\\fP#{suffix})
else
text
end
end
end
# Creates a link to something in the cargo documentation.
#
# For HTML this creates a relative link (using mdbook's 0.1's base-style
# links). For the man page it gives a direct link to doc.rust-lang.org.
#
# Usage
#
# linkcargo:reference/manifest.html[the manifest]
#
class LinkCargoInlineMacro < Extensions::InlineMacroProcessor
use_dsl
named :linkcargo
name_positional_attributes 'text'
def process parent, target, attrs
text = attrs['text']
if parent.document.basebackend? 'html'
parent.document.register :links, target
%(#{(create_anchor parent, text, type: :link, target: target).render})
elsif parent.document.backend == 'manpage'
target = %(https://doc.rust-lang.org/cargo/#{target})
%(#{(create_anchor parent, text, type: :link, target: target).render})
else
%(#{text} <#{target}>)
end
end
end
# Backticks in the manpage renderer use the CR font (courier), but in most
# cases in a terminal this doesn't look any different. Instead, use bold which
# should follow man page conventions better.
class MonoPostprocessor < Extensions::Postprocessor
def process document, output
if document.basebackend? 'manpage'
output = output.gsub(/\\f\(CR/, '\\fB')
end
output
end
end
# General utility for converting text. Example:
#
# convert:lowercase[{somevar}]
class ConvertInlineMacro < Extensions::InlineMacroProcessor
use_dsl
named :convert
name_positional_attributes 'text'
def process parent, target, attrs
text = attrs['text']
case target
when 'lowercase'
text.downcase
end
end
end
Extensions.register :uri_schemes do
inline_macro ManInlineMacro
inline_macro LinkCargoInlineMacro
inline_macro ConvertInlineMacro
postprocessor MonoPostprocessor
end

View File

@ -0,0 +1,139 @@
= cargo-bench(1)
:doctype: manpage
:actionverb: Benchmark
:nouns: benchmarks
== NAME
cargo-bench - Execute benchmarks of a package
== SYNOPSIS
`cargo bench [_OPTIONS_] [BENCHNAME] [-- _BENCH-OPTIONS_]`
== DESCRIPTION
Compile and execute benchmarks.
The benchmark filtering argument `BENCHNAME` and all the arguments following
the two dashes (`--`) are passed to the benchmark binaries and thus to
_libtest_ (rustc's built in unit-test and micro-benchmarking framework). If
you're passing arguments to both Cargo and the binary, the ones after `--` go
to the binary, the ones before go to Cargo. For details about libtest's
arguments see the output of `cargo bench -- --help`. As an example, this will
run only the benchmark named `foo` (and skip other similarly named benchmarks
like `foobar`):
cargo bench -- foo --exact
Benchmarks are built with the `--test` option to `rustc` which creates an
executable with a `main` function that automatically runs all functions
annotated with the `#[bench]` attribute. The libtest harness may be disabled
by setting `harness = false` in the target manifest settings, in which case
your code will need to provide its own `main` function to handle running
benchmarks.
== OPTIONS
=== Benchmark Options
include::options-test.adoc[]
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo bench` will build the
following targets of the selected packages:
- lib used to link with binaries and benchmarks
- bins (only if benchmark targets are built and required features are
available)
- lib as a benchmark
- bins as benchmarks
- benchmark targets
The default behavior can be changed by setting the `bench` flag for the target
in the manifest settings. Setting examples to `bench = true` will build and
run the example as a benchmark. Setting targets to `bench = false` will stop
them from being benchmarked by default. Target selection options that take a
target by name ignore the `bench` flag and will always benchmark the given
target.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
By default the Rust test harness hides output from benchmark execution to keep
results readable. Benchmark output can be recovered (e.g. for debugging) by
passing `--nocapture` to the benchmark binaries:
cargo bench -- --nocapture
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
The `--jobs` argument affects the building of the benchmark executable but
does not affect how many threads are used when running the benchmarks. The
Rust test harness runs benchmarks serially in a single thread.
include::options-jobs.adoc[]
== PROFILES
Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
linkcargo:reference/manifest.html#the-profile-sections[the reference]
for more details.
Benchmarks are always built with the `bench` profile. Binary and lib targets
are built separately as benchmarks with the `bench` profile. Library targets
are built with the `release` profiles when linked to binaries and benchmarks.
Dependencies use the `release` profile.
If you need a debug build of a benchmark, try building it with
man:cargo-build[1] which will use the `test` profile which is by default
unoptimized and includes debug information. You can then run the debug-enabled
benchmark manually.
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build and execute all the benchmarks of the current package:
cargo bench
. Run only a specific benchmark within a specific benchmark target:
cargo bench --bench bench_name -- modname::some_benchmark
== SEE ALSO
man:cargo[1], man:cargo-test[1]

View File

@ -0,0 +1,93 @@
= cargo-build(1)
:doctype: manpage
:actionverb: Build
== NAME
cargo-build - Compile the current package
== SYNOPSIS
`cargo build [_OPTIONS_]`
== DESCRIPTION
Compile local packages and all of their dependencies.
== OPTIONS
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo build` will build all
binary and library targets of the selected packages. Binaries are skipped if
they have `required-features` that are missing.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
*--out-dir* _DIRECTORY_::
Copy 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.
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
*--build-plan*::
Outputs 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.
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build the local package and all of its dependencies:
cargo build
. Build with optimizations:
cargo build --release
== SEE ALSO
man:cargo[1], man:cargo-rustc[1]

View File

@ -0,0 +1,86 @@
= cargo-check(1)
:doctype: manpage
:actionverb: Check
== NAME
cargo-check - Check the current package
== SYNOPSIS
`cargo check [_OPTIONS_]`
== DESCRIPTION
Check a local package and all of its dependencies for errors. This will
essentially compile the packages without performing the final step of code
generation, which is faster than running `cargo build`. The compiler will save
metadata files to disk so that future runs will reuse them if the source has
not been modified.
== OPTIONS
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo check` will check all
binary and library targets of the selected packages. Binaries are skipped if
they have `required-features` that are missing.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
include::options-profile.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Check the local package for errors:
cargo check
. Check all targets, including unit tests:
cargo check --all-targets --profile=test
== SEE ALSO
man:cargo[1], man:cargo-build[1]

View File

@ -0,0 +1,75 @@
= cargo-clean(1)
:doctype: manpage
:actionverb: Clean
== NAME
cargo-clean - Remove generated artifacts
== SYNOPSIS
`cargo clean [_OPTIONS_]`
== DESCRIPTION
Remove artifacts from the target directory that Cargo has generated in the
past.
With no options, `cargo clean` will delete the entire target directory.
== OPTIONS
=== Package Selection
When no packages are selected, all packages and all dependencies in the
workspace are cleaned.
*-p* _SPEC_...::
*--package* _SPEC_...::
Clean only the specified packages. This flag may be specified
multiple times. See man:cargo-pkgid[1] for the SPEC format.
=== Clean Options
*--doc*::
This option will cause `cargo clean` to remove only the `doc` directory in
the target directory.
*--release*::
Clean all artifacts that were built with the `release` or `bench`
profiles.
include::options-target-dir.adoc[]
include::options-target-triple.adoc[]
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Remove the entire target directory:
cargo clean
. Remove only the release artifacts:
cargo clean --release
== SEE ALSO
man:cargo[1], man:cargo-build[1]

View File

@ -0,0 +1,94 @@
= cargo-doc(1)
:doctype: manpage
:actionverb: Document
== NAME
cargo-doc - Build a package's documentation
== SYNOPSIS
`cargo doc [_OPTIONS_]`
== DESCRIPTION
Build the documentation for the local package and all dependencies. The output
is placed in `target/doc` in rustdoc's usual format.
== OPTIONS
=== Documentation Options
*--open*::
Open the docs in a browser after building them.
*--no-deps*::
Do not build documentation for dependencies.
*--document-private-items*::
Include non-public items in the documentation.
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo doc` will document all
binary and library targets of the selected package. The binary will be skipped
if its name is the same as the lib target. Binaries are skipped if they have
`required-features` that are missing.
The default behavior can be changed by setting `doc = false` for the target in
the manifest settings. Using target selection options will ignore the `doc`
flag and will always document the given target.
include::options-targets-lib-bin.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build the local package documentation and its dependencies and output to
`target/doc`.
cargo doc
== SEE ALSO
man:cargo[1], man:cargo-rustdoc[1], man:rustdoc[1]

View File

@ -0,0 +1,56 @@
= cargo-fetch(1)
:doctype: manpage
:actionverb: Fetch
== NAME
cargo-fetch - Fetch dependencies of a package from the network
== SYNOPSIS
`cargo fetch [_OPTIONS_]`
== DESCRIPTION
If a `Cargo.lock` file is available, this command will ensure that all of the
git dependencies and/or registry dependencies are downloaded and locally
available. Subsequent Cargo commands never touch the network after a `cargo
fetch` unless the lock file changes.
If the lock file is not available, then this command will generate the lock
file before fetching the dependencies.
If `--target` is not specified, then all target dependencies are fetched.
== OPTIONS
=== Fetch options
include::options-target-triple.adoc[]
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Fetch all dependencies:
cargo fetch
== SEE ALSO
man:cargo[1], man:cargo-update[1], man:cargo-generate-lockfile[1]

137
src/doc/man/cargo-fix.adoc Normal file
View File

@ -0,0 +1,137 @@
= cargo-fix(1)
:doctype: manpage
:actionverb: Fix
== NAME
cargo-fix - Automatically fix lint warnings reported by rustc
== SYNOPSIS
`cargo fix [_OPTIONS_]`
== DESCRIPTION
This Cargo subcommand will automatically take rustc's suggestions from
diagnostics like warnings and apply them to your source code. This is intended
to help automate tasks that rustc itself already knows how to tell you to fix!
The `cargo fix` subcommand is also being developed for the Rust 2018 edition
to provide code the ability to easily opt-in to the new edition without having
to worry about any breakage.
Executing `cargo fix` will under the hood execute man:cargo-check[1]. Any warnings
applicable to your crate will be automatically fixed (if possible) and all
remaining warnings will be displayed when the check process is finished. For
example if you'd like to prepare for the 2018 edition, you can do so by
executing:
cargo fix --edition
which behaves the same as `cargo check --all-targets`. Similarly if you'd like
to fix code for different platforms you can do:
cargo fix --edition --target x86_64-pc-windows-gnu
or if your crate has optional features:
cargo fix --edition --no-default-features --features foo
If you encounter any problems with `cargo fix` or otherwise have any questions
or feature requests please don't hesitate to file an issue at
https://github.com/rust-lang/cargo
== OPTIONS
=== Fix options
*--broken-code*::
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.
*--edition*::
Apply changes that will update the code to the latest edition. This will
not update the edition in the `Cargo.toml` manifest, which must be updated
manually.
*--edition-idioms*::
Apply suggestions that will update code to the preferred style for the
current edition.
*--allow-no-vcs*::
Fix code even if a VCS was not detected.
*--allow-dirty*::
Fix code even if the working directory has changes.
*--allow-staged*::
Fix code even if the working directory has staged changes.
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo fix` will fix all targets
(`--all-targets` implied). Binaries are skipped if they have
`required-features` that are missing.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
include::options-profile.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Apply compiler suggestions to the local package:
cargo fix
. Convert a 2015 edition to 2018:
cargo fix --edition
. Apply suggested idioms for the current edition:
cargo fix --edition-idioms
== SEE ALSO
man:cargo[1], man:cargo-check[1]

View File

@ -0,0 +1,48 @@
= cargo-generate-lockfile(1)
:doctype: manpage
== NAME
cargo-generate-lockfile - Generate the lockfile for a package
== SYNOPSIS
`cargo generate-lockfile [_OPTIONS_]`
== DESCRIPTION
This command will create the `Cargo.lock` lockfile for the current package or
workspace. If the lockfile already exists, it will be rebuilt if there are any
manifest changes or dependency updates.
See also man:cargo-update[1] which is also capable of creating a `Cargo.lock`
lockfile and has more options for controlling update behavior.
== OPTIONS
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Create or update the lockfile for the current package or workspace:
cargo generate-lockfile
== SEE ALSO
man:cargo[1], man:cargo-update[1]

View File

@ -0,0 +1,27 @@
= cargo-help(1)
:doctype: manpage
== NAME
cargo-help - Get help for a Cargo command
== SYNOPSIS
`cargo help [_SUBCOMMAND_]`
== DESCRIPTION
Prints a help message for the given command.
== EXAMPLES
. Get help for a command:
cargo help build
. Help is also available with the `--help` flag:
cargo build --help
== SEE ALSO
man:cargo[1]

View File

@ -0,0 +1,54 @@
= cargo-init(1)
:doctype: manpage
== NAME
cargo-init - Create a new Cargo package in an existing directory
== SYNOPSIS
`cargo init [_OPTIONS_] [_PATH_]`
== DESCRIPTION
This command will create a new Cargo manifest in the current directory. Give a
path as an argument to create in the given directory.
If there are typically-named Rust source files already in the directory, those
will be used. If not, then a sample `src/main.rs` file will be created, or
`src/lib.rs` if `--lib` is passed.
If the directory is not already in a VCS repository, then a new repository
is created (see `--vcs` below).
include::description-new-authors.adoc[]
See man:cargo-new[1] for a similar command which will create a new package in
a new directory.
== OPTIONS
=== Init Options
include::options-new.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Create a binary Cargo package in the current directory:
cargo init
== SEE ALSO
man:cargo[1], man:cargo-new[1]

View File

@ -0,0 +1,129 @@
= cargo-install(1)
:doctype: manpage
:actionverb: Install
== NAME
cargo-install - Build and install a Rust binary
== SYNOPSIS
[%hardbreaks]
`cargo install [_OPTIONS_] _CRATE_...`
`cargo install [_OPTIONS_] --path _PATH_`
`cargo install [_OPTIONS_] --git _URL_ [_CRATE_...]`
`cargo install [_OPTIONS_] --list`
== DESCRIPTION
This command manages Cargo's local set of installed binary crates. Only packages
which have `\[[bin]]` targets can be installed, and all binaries are installed into
the installation root's `bin` folder.
include::description-install-root.adoc[]
There are multiple sources from which a crate can be installed. The default
location is crates.io but the `--git` and `--path` flags can change this
source. If the source contains more than one package (such as crates.io or a
git repository with multiple crates) the _CRATE_ argument is required to
indicate which crate should be installed.
Crates from crates.io can optionally specify the version they wish to install
via the `--version` flags, and similarly packages from git repositories can
optionally specify the branch, tag, or revision that should be installed. If a
crate has multiple binaries, the `--bin` argument can selectively install only
one of them, and if you'd rather install examples the `--example` argument can
be used as well.
If the source is crates.io or `--git` then by default the crate will be built
in a temporary target directory. To avoid this, the target directory can be
specified by setting the `CARGO_TARGET_DIR` environment variable to a relative
path. In particular, this can be useful for caching build artifacts on
continuous integration systems.
== OPTIONS
=== Install Options
*--vers* _VERSION_::
*--version* _VERSION_::
Specify a version to install from crates.io.
*--git* _URL_::
Git URL to install the specified crate from.
*--branch* _BRANCH_::
Branch to use when installing from git.
*--tag* _TAG_::
Tag to use when installing from git.
*--rev* _SHA_::
Specific commit to use when installing from git.
*--path* _PATH_::
Filesystem path to local crate to install.
*--list*::
List all installed packages and their versions.
*-f*::
*--force*::
Force overwriting existing crates or binaries. This can be used to
reinstall or upgrade a crate.
*--bin* _NAME_...::
Install only the specified binary.
*--bins*::
Install all binaries.
*--example* _NAME_...::
Install only the specified example.
*--examples*::
Install all examples.
*--root* _DIR_::
Directory to install packages into.
include::options-registry.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
*--debug*::
Build in debug mode instead of release mode.
=== Miscellaneous Options
include::options-jobs.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Install a package from crates.io:
cargo install ripgrep
. Reinstall or upgrade a package:
cargo install ripgrep --force
== SEE ALSO
man:cargo[1], man:cargo-uninstall[1], man:cargo-search[1], man:cargo-publish[1]

View File

@ -0,0 +1,45 @@
= cargo-locate-project(1)
:doctype: manpage
== NAME
cargo-locate-project - Print a JSON representation of a Cargo.toml file's location
== SYNOPSIS
`cargo locate-project [_OPTIONS_]`
== DESCRIPTION
This command will print a JSON object to stdout with the full path to the
`Cargo.toml` manifest.
See also man:cargo-metadata[1] which is capable of returning the path to a
workspace root.
== OPTIONS
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Display the path to the manifest based on the current directory:
cargo locate-project
== SEE ALSO
man:cargo[1], man:cargo-metadata[1]

View File

@ -0,0 +1,54 @@
= cargo-login(1)
:doctype: manpage
== NAME
cargo-login - Save an API token from the registry locally
== SYNOPSIS
`cargo login [_OPTIONS_] [_TOKEN_]`
== DESCRIPTION
This command will save the API token to disk so that commands that require
authentication (such as man:cargo-publish[1]) will be automatically
authenticated. The token is saved in `$CARGO_HOME/credentials`. `CARGO_HOME`
defaults to `.cargo` in your home directory.
If the _TOKEN_ argument is not specified, it will be read from stdin.
The API token for crates.io may be retrieved from https://crates.io/me.
Take care to keep the token secret, it should not be shared with anyone else.
== OPTIONS
=== Login Options
*--host* _HOST_::
Host to set the token for. This option does not affect the behavior of the
login command, and only affects the message displayed.
include::options-registry.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Save the API token to disk:
cargo login
== SEE ALSO
man:cargo[1], man:cargo-publish[1]

View File

@ -0,0 +1,274 @@
= cargo-metadata(1)
:doctype: manpage
:source-highlighter: highlightjs
== NAME
cargo-metadata - Machine-readable metadata about the current package
== SYNOPSIS
`cargo metadata [_OPTIONS_]`
== DESCRIPTION
Output the resolved dependencies of a package, the concrete used versions
including overrides, in JSON to stdout.
It is recommended to include the `--format-version` flag to future-proof
your code to ensure the output is in the format you are expecting.
See the link:https://crates.io/crates/cargo_metadata[cargo_metadata crate]
for a Rust API for reading the metadata.
== OUTPUT FORMAT
The output has the following format:
[source,javascript]
----
{
/* Array of all packages in the workspace.
It also includes all feature-enabled dependencies unless --no-deps is used.
*/
"packages": [
{
/* The name of the package. */
"name": "my-package",
/* The version of the package. */
"version": "0.1.0",
/* The Package ID, a unique identifier for referring to the package. */
"id": "my-package 0.1.0 (path+file:///path/to/my-package)",
/* The license value from the manifest, or null. */
"license": "MIT/Apache-2.0",
/* The license-file value from the manifest, or null. */
"license_file": "LICENSE",
/* The description value from the manifest, or null. */
"description": "Package description.",
/* The source ID of the package. This represents where
a package is retrieved from.
This is null for path dependencies and workspace members.
For other dependencies, it is a string with the format:
- "registry+URL" for registry-based dependencies.
Example: "registry+https://github.com/rust-lang/crates.io-index"
- "git+URL" for git-based dependencies.
Example: "git+https://github.com/rust-lang/cargo?rev=5e85ba14aaa20f8133863373404cb0af69eeef2c#5e85ba14aaa20f8133863373404cb0af69eeef2c"
*/
"source": null,
/* Array of dependencies declared in the package's manifest. */
"dependencies": [
{
/* The name of the dependency. */
"name": "bitflags",
/* The source ID of the dependency. */
"source": "registry+https://github.com/rust-lang/crates.io-index",
/* The version requirement for the dependency.
Dependencies without a version requirement have a value of "*".
*/
"req": "^1.0",
/* The dependency kind.
"dev", "build", or null for a normal dependency.
*/
"kind": null,
/* If the dependency is renamed, this is the new name for
the dependency as a string. null if it is not renamed.
*/
"rename": null,
/* Boolean of whether or not this is an optional dependency. */
"optional": false,
/* Boolean of whether or not default features are enabled. */
"uses_default_features": true,
/* Array of features enabled. */
"features": [],
/* The target platform for the dependency.
null if not a target dependency.
*/
"target": "cfg(windows)"
}
],
/* Array of Cargo targets. */
"targets": [
{
/* Array of target kinds.
- lib targets list the `crate-type` values from the
manifest such as "lib", "rlib", "dylib",
"proc-macro", etc. (default ["lib"])
- binary is ["bin"]
- example is ["example"]
- integration test is ["test"]
- benchmark is ["bench"]
- build script is ["custom-build"]
*/
"kind": [
"bin"
],
/* Array of crate types.
- lib and example libraries list the `crate-type` values
from the manifest such as "lib", "rlib", "dylib",
"proc-macro", etc. (default ["lib"])
- all other target kinds are ["bin"]
*/
"crate_types": [
"bin"
],
/* The name of the target. */
"name": "my-package",
/* Absolute path to the root source file of the target. */
"src_path": "/path/to/my-package/src/main.rs",
/* The Rust edition of the target.
Defaults to the package edition.
*/
"edition": "2018",
/* Array of required features.
This property is not included if no required features are set.
*/
"required-features": ["feat1"]
}
],
/* Set of features defined for the package.
Each feature maps to an array of features or dependencies it
enables.
*/
"features": {
"default": [
"feat1"
],
"feat1": [],
"feat2": []
},
/* Absolute path to this package's manifest. */
"manifest_path": "/path/to/my-package/Cargo.toml",
/* Package metadata.
This is null if no metadata is specified.
*/
"metadata": {
"docs": {
"rs": {
"all-features": true
}
}
},
/* Array of authors from the manifest.
Empty array if no authors specified.
*/
"authors": [
"Jane Doe <user@example.com>"
],
/* Array of categories from the manifest. */
"categories": [
"command-line-utilities"
],
/* Array of keywords from the manifest. */
"keywords": [
"cli"
],
/* The readme value from the manifest or null if not specified. */
"readme": "README.md",
/* The repository value from the manifest or null if not specified. */
"repository": "https://github.com/rust-lang/cargo",
/* The default edition of the package.
Note that individual targets may have different editions.
*/
"edition": "2018"
}
],
/* Array of members of the workspace.
Each entry is the Package ID for the package.
*/
"workspace_members": [
"my-package 0.1.0 (path+file:///path/to/my-package)",
],
/* The resolved dependency graph, with the concrete versions and features
selected. The set depends on the enabled features.
This is null if --no-deps is specified.
*/
"resolve": {
/* Array of nodes within the dependency graph.
Each node is a package.
*/
"nodes": [
{
/* The Package ID of this node. */
"id": "my-package 0.1.0 (path+file:///path/to/my-package)",
/* The dependencies of this package, an array of Package IDs. */
"dependencies": [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)"
],
/* The dependencies of this package. This is an alternative to
"dependencies" which contains additional information. In
particular, this handles renamed dependencies.
*/
"deps": [
{
/* The name of the dependency.
If this is a renamed dependency, this is the new
name.
*/
"name": "bitflags",
/* The Package ID of the dependency. */
"pkg": "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)"
}
],
/* Array of features enabled on this package. */
"features": [
"default"
]
}
],
/* The root package of the workspace.
This is null if this is a virtual workspace. Otherwise it is
the Package ID of the root package.
*/
"root": "my-package 0.1.0 (path+file:///path/to/my-package)"
},
/* The absolute path to the build directory where Cargo places its output. */
"target_directory": "/path/to/my-package/target",
/* The version of the schema for this metadata structure.
This will be changed if incompatible changes are ever made.
*/
"version": 1,
/* The absolute path to the root of the workspace. */
"workspace_root": "/path/to/my-package"
}
----
== OPTIONS
=== Output Options
*--no-deps*::
Output information only about the workspace members and don't fetch
dependencies.
*--format-version* _VERSION_::
Specify the version of the output format to use. Currently `1` is the only
possible value.
include::options-features.adoc[]
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Output JSON about the current package:
cargo metadata --format-version=1
== SEE ALSO
man:cargo[1]

View File

@ -0,0 +1,49 @@
= cargo-new(1)
:doctype: manpage
== NAME
cargo-new - Create a new Cargo package
== SYNOPSIS
`cargo new [_OPTIONS_] _PATH_`
== DESCRIPTION
This command will create a new Cargo package in the given directory. This
includes a simple template with a `Cargo.toml` manifest, sample source file,
and a VCS ignore file. If the directory is not already in a VCS repository,
then a new repository is created (see `--vcs` below).
include::description-new-authors.adoc[]
See man:cargo-init[1] for a similar command which will create a new manifest
in an existing directory.
== OPTIONS
=== New Options
include::options-new.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Create a binary Cargo package in the given directory:
cargo new foo
== SEE ALSO
man:cargo[1], man:cargo-init[1]

View File

@ -0,0 +1,79 @@
= cargo-owner(1)
:doctype: manpage
== NAME
cargo-owner - Manage the owners of a crate on the registry
== SYNOPSIS
[%hardbreaks]
`cargo owner [_OPTIONS_] --add _LOGIN_ [_CRATE_]`
`cargo owner [_OPTIONS_] --remove _LOGIN_ [_CRATE_]`
`cargo owner [_OPTIONS_] --list [_CRATE_]`
== DESCRIPTION
This command will modify the owners for a crate on the registry. Owners of a
crate can upload new versions and yank old versions. Non-team owners can also
modify the set of owners, so take care!
This command requires you to be authenticated with either the `--token` option
or using man:cargo-login[1].
If the crate name is not specified, it will use the package name from the
current directory.
See linkcargo:reference/publishing.html#cargo-owner[the reference] for more
information about owners and publishing.
== OPTIONS
=== Owner Options
*-a*::
*--add* _LOGIN_...::
Add the given user or team as an owner.
*-r*::
*--remove* _LOGIN_...::
Remove the given user or team as an owner.
*-l*::
*--list*::
List owners of a crate.
include::options-token.adoc[]
include::options-index.adoc[]
include::options-registry.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. List owners of a package:
cargo owner --list foo
. Add an owner to a package:
cargo owner --add username foo
. Remove an owner from a package:
cargo owner --remove username foo
== SEE ALSO
man:cargo[1], man:cargo-login[1], man:cargo-publish[1]

View File

@ -0,0 +1,90 @@
= cargo-package(1)
:doctype: manpage
:actionverb: Package
== NAME
cargo-package - Assemble the local package into a distributable tarball
== SYNOPSIS
`cargo package [_OPTIONS_]`
== DESCRIPTION
This command will create a distributable, compressed `.crate` file with the
source code of the package in the current directory. The resulting file will
be stored in the `target/package` directory. This performs the following
steps:
. Load and check the current workspace, performing some basic checks.
- Path dependencies are not allowed unless they have a version key. Cargo
will ignore the path key for dependencies in published packages.
. Create the compressed `.crate` file.
- The original `Cargo.toml` file is rewritten and normalized.
- A `.cargo_vcs_info.json` file is included that contains information
about the current VCS checkout hash if available (not included with
`--allow-dirty`).
. Extract the `.crate` file and build it to verify it can build.
. Check that build scripts did not modify any source files.
The list of files included can be controlled with the `include` and `exclude`
fields in the manifest.
See linkcargo:reference/publishing.html[the reference] for more details about
packaging and publishing.
== OPTIONS
=== Package Options
*-l*::
*--list*::
Print files included in a package without making one.
*--no-verify*::
Don't verify the contents by building them.
*--no-metadata*::
Ignore warnings about a lack of human-usable metadata (such as the
description or the license).
*--allow-dirty*::
Allow working directories with uncommitted VCS changes to be packaged.
=== Compilation Options
include::options-target-triple.adoc[]
include::options-target-dir.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Create a compressed `.crate` file of the current package:
cargo package
== SEE ALSO
man:cargo[1], man:cargo-publish[1]

View File

@ -0,0 +1,93 @@
= cargo-pkgid(1)
:doctype: manpage
== NAME
cargo-pkgid - Print a fully qualified package specification
== SYNOPSIS
`cargo pkgid [_OPTIONS_] [_SPEC_]`
== DESCRIPTION
Given a _SPEC_ argument, print out the fully qualified package ID specifier
for a package or dependency in the current workspace. This command will
generate an error if _SPEC_ is ambiguous as to which package it refers to in
the dependency graph. If no _SPEC_ is given, then the specifier for the local
package is printed.
This command requires that a lockfile is available and dependencies have been
fetched.
A package specifier consists of a name, version, and source URL. You are
allowed to use partial specifiers to succinctly match a specific package as
long as it matches only one package. The format of a _SPEC_ can be one of the
following:
[%autowidth]
.SPEC Query Format
|===
|SPEC Structure |Example SPEC
|__NAME__
|`bitflags`
|__NAME__``:``__VERSION__
|`bitflags:1.0.4`
|__URL__
|`https://github.com/rust-lang/cargo`
|__URL__``#``__VERSION__
|`https://github.com/rust-lang/cargo#0.33.0`
|__URL__``#``__NAME__
|`https://github.com/rust-lang/crates.io-index#bitflags`
|__URL__``#``__NAME__``:``__VERSION__
|`https://github.com/rust-lang/cargo#crates-io:0.21.0`
|===
== OPTIONS
=== Package Selection
*-p* _SPEC_::
*--package* _SPEC_::
Get the package ID for the given package instead of the current package.
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Retrieve package specification for `foo` package:
cargo pkgid foo
. Retrieve package specification for version 1.0.0 of `foo`:
cargo pkgid foo:1.0.0
. Retrieve package specification for `foo` from crates.io:
cargo pkgid https://github.com/rust-lang/crates.io-index#foo
== SEE ALSO
man:cargo[1], man:cargo-generate-lockfile[1], man:cargo-metadata[1]

View File

@ -0,0 +1,88 @@
= cargo-publish(1)
:doctype: manpage
:actionverb: Publish
== NAME
cargo-publish - Upload a package to the registry
== SYNOPSIS
`cargo package [_OPTIONS_]`
== DESCRIPTION
This command will create a distributable, compressed `.crate` file with the
source code of the package in the current directory and upload it to a
registry. The default registry is https://crates.io. This performs the
following steps:
. Performs a few checks, including:
- No `[patch]` sections are allowed in the manifest.
- Checks the `package.publish` key in the manifest for restrictions on which
registries you are allowed to publish to.
. Create a `.crate` file by following the steps in man:cargo-package[1].
. Upload the crate to the registry. Note that the server will perform
additional checks on the crate.
This command requires you to be authenticated with either the `--token` option
or using man:cargo-login[1].
See linkcargo:reference/publishing.html[the reference] for more details about
packaging and publishing.
== OPTIONS
=== Publish Options
*--dry-run*::
Perform all checks without uploading.
include::options-token.adoc[]
*--no-verify*::
Don't verify the contents by building them.
*--allow-dirty*::
Allow working directories with uncommitted VCS changes to be packaged.
include::options-index.adoc[]
include::options-registry.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-target-dir.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Publish the current package:
cargo publish
== SEE ALSO
man:cargo[1], man:cargo-package[1], man:cargo-login[1]

View File

@ -0,0 +1,88 @@
= cargo-run(1)
:doctype: manpage
:actionverb: Run
== NAME
cargo-run - Run the current package
== SYNOPSIS
`cargo run [_OPTIONS_] [-- _ARGS_]`
== DESCRIPTION
Build the the main binary of the local package (`src/main.rs`) and run it.
All the arguments following the two dashes (`--`) are passed to the binary to
run. If you're passing arguments to both Cargo and the binary, the ones after
`--` go to the binary, the ones before go to Cargo.
== OPTIONS
=== Package Selection
include::options-package.adoc[]
=== Target Selection
When no target selection options are given, `cargo run` will run the binary
target. If there are multiple binary targets, you must pass a target flag to
choose one.
*--bin* _NAME_::
Run the specified binary.
*--example* _NAME_::
Run the specified example.
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build the local package and run its main target:
cargo run
. Run an example with extra arguments:
cargo run --example exname -- --exoption exarg1 exarg2
== SEE ALSO
man:cargo[1], man:cargo-build[1]

View File

@ -0,0 +1,93 @@
= cargo-rustc(1)
:doctype: manpage
:actionverb: Build
== NAME
cargo-rustc - Compile the current package, and pass extra options to the compiler
== SYNOPSIS
`cargo rustc [_OPTIONS_] [-- _ARGS_]`
== DESCRIPTION
The specified target for the current package (or package specified by `-p` if
provided) will be compiled along with all of its dependencies. The specified
_ARGS_ will all be passed to the final compiler invocation, not any of the
dependencies. Note that the compiler will still unconditionally receive
arguments such as `-L`, `--extern`, and `--crate-type`, and the specified
_ARGS_ will simply be added to the compiler invocation.
See https://doc.rust-lang.org/rustc/index.html for documentation on rustc
flags.
include::description-one-target.adoc[]
To pass flags to all compiler processes spawned by Cargo, use the `RUSTFLAGS`
environment variable or the `build.rustflags`
linkcargo:reference/config.html[config value].
== OPTIONS
=== Package Selection
include::options-package.adoc[]
=== Target Selection
When no target selection options are given, `cargo rustc` will build all
binary and library targets of the selected package.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Check if your package (not including dependencies) uses unsafe code:
cargo rustc --lib -- -D unsafe-code
. Try an experimental flag on the nightly compiler, such as this which prints
the size of every type:
cargo rustc --lib -- -Z print-type-sizes
== SEE ALSO
man:cargo[1], man:cargo-build[1], man:rustc[1]

View File

@ -0,0 +1,95 @@
= cargo-rustdoc(1)
:doctype: manpage
:actionverb: Document
== NAME
cargo-rustdoc - Build a package's documentation, using specified custom flags
== SYNOPSIS
`cargo rustdoc [_OPTIONS_] [-- _ARGS_]`
== DESCRIPTION
The specified target for the current package (or package specified by `-p` if
provided) will be documented with the specified _ARGS_ being passed to the
final rustdoc invocation. Dependencies will not be documented as part of this
command. Note that rustdoc will still unconditionally receive arguments such
as `-L`, `--extern`, and `--crate-type`, and the specified _ARGS_ will simply
be added to the rustdoc invocation.
See https://doc.rust-lang.org/rustdoc/index.html for documentation on rustdoc
flags.
include::description-one-target.adoc[]
To pass flags to all rustdoc processes spawned by Cargo, use the
`RUSTDOCFLAGS` environment variable or the `build.rustdocflags` configuration
option.
== OPTIONS
=== Documentation Options
*--open*::
Open the docs in a browser after building them.
=== Package Selection
include::options-package.adoc[]
=== Target Selection
When no target selection options are given, `cargo rustdoc` will document all
binary and library targets of the selected package. The binary will be skipped
if its name is the same as the lib target. Binaries are skipped if they have
`required-features` that are missing.
include::options-targets.adoc[]
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
include::options-jobs.adoc[]
include::section-profiles.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Build documentation with custom CSS included from a given file:
cargo rustdoc --lib -- --extend-css extra.css
== SEE ALSO
man:cargo[1], man:cargo-doc[1], man:rustdoc[1]

View File

@ -0,0 +1,48 @@
= cargo-search(1)
:doctype: manpage
== NAME
cargo-search - Search packages in crates.io
== SYNOPSIS
`cargo search [_OPTIONS_] [_QUERY_...]`
== DESCRIPTION
This performs a textual search for crates on https://crates.io. The matching
crates will be displayed along with their description in TOML format suitable
for copying into a `Cargo.toml` manifest.
== OPTIONS
=== Search Options
*--limit* _LIMIT_::
Limit the number of results (default: 10, max: 100).
include::options-index.adoc[]
include::options-registry.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Search for a package from crates.io:
cargo search serde
== SEE ALSO
man:cargo[1], man:cargo-install[1], man:cargo-publish[1]

146
src/doc/man/cargo-test.adoc Normal file
View File

@ -0,0 +1,146 @@
= cargo-test(1)
:doctype: manpage
:actionverb: Test
:nouns: tests
== NAME
cargo-test - Execute unit and integration tests of a package
== SYNOPSIS
`cargo test [_OPTIONS_] [TESTNAME] [-- _TEST-OPTIONS_]`
== DESCRIPTION
Compile and execute unit and integration tests.
The test filtering argument `TESTNAME` and all the arguments following the two
dashes (`--`) are passed to the test binaries and thus to _libtest_ (rustc's
built in unit-test and micro-benchmarking framework). If you're passing
arguments to both Cargo and the binary, the ones after `--` go to the binary,
the ones before go to Cargo. For details about libtest's arguments see the
output of `cargo test -- --help`. As an example, this will run all tests with
`foo` in their name on 3 threads in parallel:
cargo test foo -- --test-threads 3
Tests are built with the `--test` option to `rustc` which creates an
executable with a `main` function that automatically runs all functions
annotated with the `#[test]` attribute in multiple threads. The libtest
harness may be disabled by setting `harness = false` in the target manifest
settings, in which case your code will need to provide its own `main` function
to handle running tests.
Documentation tests are also run by default, which is handled by `rustdoc`. It
extracts code samples from documentation comments and executes them.
== OPTIONS
=== Test Options
include::options-test.adoc[]
=== Package Selection
include::options-packages.adoc[]
=== Target Selection
When no target selection options are given, `cargo test` will build the
following targets of the selected packages:
- lib used to link with binaries, examples, integration tests, and doc tests
- bins (only if integration tests are built and required features are
available)
- examples to ensure they compile
- lib as a unit test
- bins as unit tests
- integration tests
- doc tests for the lib target
The default behavior can be changed by setting the `test` flag for the target
in the manifest settings. Setting examples to `test = true` will build and run
the example as a test. Setting targets to `test = false` will stop them from
being tested by default. Target selection options that take a target by name
ignore the `test` flag and will always test the given target.
Doc tests for libraries may be disabled by setting `doctest = false` for the
library in the manifest.
include::options-targets.adoc[]
*--doc*::
Test only the library's documentation. This cannot be mixed with other
target options.
include::options-features.adoc[]
=== Compilation Options
include::options-target-triple.adoc[]
include::options-release.adoc[]
=== Output Options
include::options-target-dir.adoc[]
=== Display Options
By default the Rust test harness hides output from test execution to keep
results readable. Test output can be recovered (e.g. for debugging) by passing
`--nocapture` to the test binaries:
cargo test -- --nocapture
include::options-display.adoc[]
include::options-message-format.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
=== Miscellaneous Options
The `--jobs` argument affects the building of the test executable but does not
affect how many threads are used when running the tests. The Rust test harness
includes an option to control the number of threads used:
cargo test -j 2 -- --test-threads=2
include::options-jobs.adoc[]
include::section-profiles.adoc[]
Unit tests are separate executable artifacts which use the `test`/`bench`
profiles. Example targets are built the same as with `cargo build` (using the
`dev`/`release` profiles) unless you are building them with the test harness
(by setting `test = true` in the manifest or using the `--example` flag) in
which case they use the `test`/`bench` profiles. Library targets are built
with the `dev`/`release` profiles when linked to an integration test, binary,
or doctest.
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Execute all the unit and integration tests of the current package:
cargo test
. Run only a specific test within a specific integration test:
cargo test --test int_test_name -- modname::test_name
== SEE ALSO
man:cargo[1], man:cargo-bench[1]

View File

@ -0,0 +1,56 @@
= cargo-uninstall(1)
:doctype: manpage
== NAME
cargo-uninstall - Remove a Rust binary
== SYNOPSIS
`cargo uninstall [_OPTIONS_] [_SPEC_...]`
== DESCRIPTION
This command removes a package installed with man:cargo-install[1]. The _SPEC_
argument is a package ID specification of the package to remove (see
man:cargo-pkgid[1]).
By default all binaries are removed for a crate but the `--bin` and
`--example` flags can be used to only remove particular binaries.
include::description-install-root.adoc[]
== OPTIONS
=== Install Options
*-p*::
*--package* _SPEC_...::
Package to uninstall.
*--bin* _NAME_...::
Only uninstall the binary _NAME_.
*--root* _DIR_::
Directory to uninstall packages from.
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Uninstall a previously installed package.
cargo uninstall ripgrep
== SEE ALSO
man:cargo[1], man:cargo-install[1]

View File

@ -0,0 +1,77 @@
= cargo-update(1)
:doctype: manpage
== NAME
cargo-update - Update dependencies as recorded in the local lock file
== SYNOPSIS
`cargo update [_OPTIONS_]`
== DESCRIPTION
This command will update dependencies in the `Cargo.lock` file to the latest
version. It requires that the `Cargo.lock` file already exists as generated
by commands such as man:cargo-build[1] or man:cargo-generate-lockfile[1].
== OPTIONS
=== Update Options
*-p* _SPEC_...::
*--package* _SPEC_...::
Update only the specified packages. This flag may be specified
multiple times. See man:cargo-pkgid[1] for the SPEC format.
+
If packages are specified with the `-p` flag, 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 `-p` is not specified, all dependencies are updated.
*--aggressive*::
When used with `-p`, dependencies of _SPEC_ are forced to update as well.
Cannot be used with `--precise`.
*--precise* _PRECISE_::
When used with `-p`, 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).
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Update all dependencies in the lockfile:
cargo update
. Update only specific dependencies:
cargo update -p foo -p bar
. Set a specific dependency to a specific version:
cargo update -p foo --precise 1.2.3
== SEE ALSO
man:cargo[1], man:cargo-generate-lockfile[1]

View File

@ -0,0 +1,56 @@
= cargo-verify-project(1)
:doctype: manpage
== NAME
cargo-verify-project - Check correctness of crate manifest
== SYNOPSIS
`cargo verify-project [_OPTIONS_]`
== DESCRIPTION
This command will parse the local manifest and check its validity. It emits a
JSON object with the result. A successful validation will display:
{"success":"true"}
An invalid workspace will display:
{"invalid":"human-readable error message"}
== OPTIONS
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-manifest-path.adoc[]
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
== Exit Status
0::
The workspace is OK.
1::
The workspace is invalid.
== EXAMPLES
. Check the current workspace for errors:
cargo verify-project
== SEE ALSO
man:cargo[1], man:cargo-package[1]

View File

@ -0,0 +1,38 @@
= cargo-version(1)
:doctype: manpage
== NAME
cargo-version - Show version information
== SYNOPSIS
`cargo version [_OPTIONS_]`
== DESCRIPTION
Displays the version of Cargo.
== OPTIONS
*-v*::
*--verbose*::
Display additional version information.
== EXAMPLES
. Display the version:
cargo version
. The version is also available via flags:
cargo --version
cargo -V
. Display extra version information:
cargo -Vv
== SEE ALSO
man:cargo[1]

View File

@ -0,0 +1,63 @@
= cargo-yank(1)
:doctype: manpage
== NAME
cargo-yank - Remove a pushed crate from the index
== SYNOPSIS
`cargo yank [_OPTIONS_] --vers _VERSION_ [_CRATE_]`
== DESCRIPTION
The yank command removes a previously published crate's version from the
server's index. This command does not delete any data, and the crate will
still be available for download via the registry's download link.
Note that existing crates locked to a yanked version will still be able to
download the yanked version to use it. Cargo will, however, not allow any new
crates to be locked to any yanked version.
This command requires you to be authenticated with either the `--token` option
or using man:cargo-login[1].
If the crate name is not specified, it will use the package name from the
current directory.
== OPTIONS
=== Owner Options
*--vers* _VERSION_::
The version to yank or un-yank.
*--undo*::
Undo a yank, putting a version back into the index.
include::options-token.adoc[]
include::options-index.adoc[]
include::options-registry.adoc[]
=== Display Options
include::options-display.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== EXAMPLES
. Yank a crate from the index:
cargo yank --vers 1.0.7 foo
== SEE ALSO
man:cargo[1], man:cargo-login[1], man:cargo-publish[1]

217
src/doc/man/cargo.adoc Normal file
View File

@ -0,0 +1,217 @@
= cargo(1)
:doctype: manpage
== NAME
cargo - The Rust package manager
== SYNOPSIS
[%hardbreaks]
`cargo [_OPTIONS_] _COMMAND_ [_ARGS_]`
`cargo [_OPTIONS_] --version`
`cargo [_OPTIONS_] --list`
`cargo [_OPTIONS_] --help`
`cargo [_OPTIONS_] --explain _CODE_`
== DESCRIPTION
This program is a package manager and build tool for the Rust language,
available at <http://rust-lang.org>.
== COMMANDS
=== Build Commands
man:cargo-bench[1]::
Execute benchmarks of a package.
man:cargo-build[1]::
Compile a package.
man:cargo-check[1]::
Check a local package and all of its dependencies for errors.
man:cargo-clean[1]::
Remove artifacts that Cargo has generated in the past.
man:cargo-doc[1]::
Build a package's documentation.
man:cargo-fetch[1]::
Fetch dependencies of a package from the network.
man:cargo-fix[1]::
Automatically fix lint warnings reported by rustc.
man:cargo-run[1]::
Run a binary of the local package.
man:cargo-rustc[1]::
Compile a package, and pass extra options to the compiler.
man:cargo-rustdoc[1]::
Build a package's documentation, using specified custom flags.
man:cargo-test[1]::
Execute unit and integration tests of a package.
=== Manifest Commands
man:cargo-generate-lockfile[1]::
Generate `Cargo.lock` for a project.
man:cargo-locate-project[1]::
Print a JSON representation of a `Cargo.toml` file's location.
man:cargo-metadata[1]::
Output the resolved dependencies of a package, the concrete used versions
including overrides, in machine-readable format.
man:cargo-pkgid[1]::
Print a fully qualified package specification.
man:cargo-update[1]::
Update dependencies as recorded in the local lock file.
man:cargo-verify-project[1]::
Check correctness of crate manifest.
=== Package Commands
man:cargo-init[1]::
Create a new Cargo package in an existing directory.
man:cargo-install[1]::
Build and install a Rust binary.
man:cargo-new[1]::
Create a new Cargo package.
man:cargo-search[1]::
Search packages in crates.io.
man:cargo-uninstall[1]::
Remove a Rust binary.
=== Publishing Commands
man:cargo-login[1]::
Save an API token from the registry locally.
man:cargo-owner[1]::
Manage the owners of a crate on the registry.
man:cargo-package[1]::
Assemble the local package into a distributable tarball.
man:cargo-publish[1]::
Upload a package to the registry.
man:cargo-yank[1]::
Remove a pushed crate from the index.
=== General Commands
man:cargo-help[1]::
Display help information about Cargo.
man:cargo-version[1]::
Show version information.
== OPTIONS
=== Special Options
*-V*::
*--version*::
Print version info and exit. If used with `--verbose`, prints extra
information.
*--list*::
List all installed Cargo subcommands. If used with `--verbose`, prints
extra information.
*--explain _CODE_*::
Run `rustc --explain CODE` which will print out a detailed explanation of
an error message (for example, `E0004`).
=== Display Options
include::options-display.adoc[]
=== Manifest Options
include::options-locked.adoc[]
=== Common Options
include::options-common.adoc[]
include::section-environment.adoc[]
include::section-exit-status.adoc[]
== FILES
`~/.cargo/`::
Default location for Cargo's "home" directory where it stores various
files. The location can be changed with the `CARGO_HOME` environment
variable.
`$CARGO_HOME/bin/`::
Binaries installed by man:cargo-install[1] will be located here. If using
rustup, executables distributed with Rust are also located here.
`$CARGO_HOME/config`::
The global configuration file. See linkcargo:reference/config.html[the reference]
for more information about configuration files.
`.cargo/config`::
Cargo automatically searches for a file named `.cargo/config` in the
current directory, and all parent directories. These configuration files
will be merged with the global configuration file.
`$CARGO_HOME/credentials`::
Private authentication information for logging in to a registry.
`$CARGO_HOME/registry/`::
This directory contains cached downloads of the registry index and any
downloaded dependencies.
`$CARGO_HOME/git/`::
This directory contains cached downloads of git dependencies.
== EXAMPLES
. Build a local package and all of its dependencies:
cargo build
. Build a package with optimizations:
cargo build --release
. Run tests for a cross-compiled target:
cargo test --target i686-unknown-linux-gnu
. Create a new package that builds an executable:
cargo new foobar
. Create a package in the current directory:
mkdir foo && cd foo
cargo init .
. Learn about a command's options and usage:
cargo help clean
== BUGS
See https://github.com/rust-lang/cargo/issues for issues.
== SEE ALSO
man:rustc[1], man:rustdoc[1]

View File

@ -0,0 +1,7 @@
The installation root is determined, in order of precedence:
- `--root` option
- `CARGO_INSTALL_ROOT` environment variable
- `install.root` Cargo linkcargo:reference/config.html[config value]
- `CARGO_HOME` environment variable
- `$HOME/.cargo`

View File

@ -0,0 +1,24 @@
The "authors" field in the manifest is determined from the environment or
configuration settings. A name is required and is determined from (first match
wins):
- `cargo-new.name` Cargo config value
- `CARGO_NAME` environment variable
- `GIT_AUTHOR_NAME` environment variable
- `GIT_COMMITTER_NAME` environment variable
- `user.name` git configuration value
- `USER` environment variable
- `USERNAME` environment variable
- `NAME` environment variable
The email address is optional and is determined from:
- `cargo-new.email` Cargo config value
- `CARGO_EMAIL` environment variable
- `GIT_AUTHOR_EMAIL` environment variable
- `GIT_COMMITTER_EMAIL` environment variable
- `user.email` git configuration value
- `EMAIL` environment variable
See linkcargo:reference/config.html[the reference] for more information about
configuration files.

View File

@ -0,0 +1,4 @@
This command requires that only one target is being compiled when additional
arguments are provided. If more than one target is available for the current
package the filters of `--lib`, `--bin`, etc, must be used to select which
target is compiled.

View File

@ -0,0 +1,7 @@
*-h*::
*--help*::
Prints help information.
*-Z* _FLAG_...::
Unstable (nightly-only) flags to Cargo. Run `cargo -Z help` for
details.

View File

@ -0,0 +1,22 @@
*-v*::
*--verbose*::
Use 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`
linkcargo:reference/config.html[config value].
*-q*::
*--quiet*::
No output printed to stdout.
*--color* _WHEN_::
Control when colored output is used. Valid values:
+
- `auto` (default): Automatically detect if color support is available on the
terminal.
- `always`: Always display colors.
- `never`: Never display colors.
+
May also be specified with the `term.color`
linkcargo:reference/config.html[config value].

View File

@ -0,0 +1,16 @@
=== Feature Selection
When no feature options are given, the `default` feature is activated for
every selected package.
*--features* _FEATURES_::
Space or comma separated list of features to activate. These features only
apply to the current directory's package. Features of direct dependencies
may be enabled with `<dep-name>/<feature-name>` syntax.
*--all-features*::
Activate all available features of all selected packages.
*--no-default-features*::
Do not activate the `default` feature of the current directory's
package.

View File

@ -0,0 +1,2 @@
*--index* _INDEX_::
The URL of the registry index to use.

View File

@ -0,0 +1,5 @@
*-j* _N_::
*--jobs* _N_::
Number of parallel jobs to run. May also be specified with the
`build.jobs` linkcargo:reference/config.html[config value]. Defaults to
the number of CPUs.

View File

@ -0,0 +1,10 @@
*--frozen*::
*--locked*::
Either of these flags requires that the `Cargo.lock` file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The `--frozen` flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.
+
These may be used in environments where you want to assert that the
`Cargo.lock` file is up-to-date (such as a CI build) or want to avoid network
access.

View File

@ -0,0 +1,3 @@
*--manifest-path* _PATH_::
Path to the `Cargo.toml` file. By default, Cargo searches in the current
directory or any parent directory for the `Cargo.toml` file.

View File

@ -0,0 +1,6 @@
*--message-format* _FMT_::
The output format for diagnostic messages. Valid values:
+
- `human` (default): Display in a human-readable text format.
- `json`: Emit JSON messages to stdout.
- `short`: Emit shorter, human-readable text messages.

View File

@ -0,0 +1,26 @@
*--bin*::
Create a package with a binary target (`src/main.rs`).
This is the default behavior.
*--lib*::
Create a package with a library target (`src/lib.rs`).
*--edition* _EDITION_::
Specify the Rust edition to use. Default is 2018.
Possible values: 2015, 2018
*--name* _NAME_::
Set the package name. Defaults to the directory name.
*--vcs* _VCS_::
Initialize 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.
*--registry* _REGISTRY_::
Alternative registry to use. This sets the `publish` field which will
restrict publishing only to the given registry name.
+
This option is unstable and available only on the nightly channel and requires
the `-Z unstable-options` flag to enable.

View File

@ -0,0 +1,7 @@
By default, the package in the current working directory is selected. The `-p`
flag can be used to choose a different package in a workspace.
*-p* _SPEC_::
*--package* _SPEC_::
The package to convert:lowercase[{actionverb}]. See man:cargo-pkgid[1] for
the SPEC format.

View File

@ -0,0 +1,18 @@
By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (`--all` is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the `workspace.default-members` key in the root `Cargo.toml`
manifest.
*-p* _SPEC_...::
*--package* _SPEC_...::
{actionverb} only the specified packages. See man:cargo-pkgid[1] for the
SPEC format. This flag may be specified multiple times.
*--all*::
{actionverb} all members in the workspace.
*--exclude* _SPEC_...::
Exclude the specified packages. Must be used in conjunction with the
`--all` flag. This flag may be specified multiple times.

View File

@ -0,0 +1,6 @@
*--profile* _NAME_::
Changes convert:lowercase[{actionverb}] behavior. Currently only `test` is
supported, which will convert:lowercase[{actionverb}] with the
`#[cfg(test)]` attribute enabled. This is useful to have it
convert:lowercase[{actionverb}] unit tests which are usually excluded via
the `cfg` attribute. This does not change the actual profile used.

View File

@ -0,0 +1,5 @@
*--registry* _REGISTRY_::
Alternative registry to use.
+
This option is unstable and available only on the nightly channel and requires
the `-Z unstable-options` flag to enable.

View File

@ -0,0 +1,3 @@
*--release*::
{actionverb} artifacts in release mode, with optimizations. See the
<<PROFILES>> section for details on how this affects profile selection.

View File

@ -0,0 +1,5 @@
*--target-dir* _DIRECTORY_::
Directory for all generated artifacts and intermediate files. May also be
specified with the `CARGO_TARGET_DIR` environment variable, or the
`build.target-dir` linkcargo:reference/config.html[config value]. Defaults
to `target` in the root of the workspace.

View File

@ -0,0 +1,22 @@
*--target* _TRIPLE_::
{actionverb} for the given architecture. The default is the host architecture.
+
The general format of the triple is `<arch><sub>-<vendor>-<sys>-<abi>` where:
+
- `arch` = The base CPU architecture, for example `x86_64`, `i686`, `arm`,
`thumb`, `mips`, etc.
- `sub` = The CPU sub-architecture, for example `arm` has `v7`, `v7s`, `v5te`,
etc.
- `vendor` = The vendor, for example `unknown`, `apple`, `pc`, `linux`, etc.
- `sys` = The system name, for example `linux`, `windows`, etc. `none` is
typically used for bare-metal without an OS.
- `abi` = The ABI, for example `gnu`, `android`, `eabi`, etc.
+
--
Some parameters may be omitted. Run `rustc --print target-list` for a list of
supported targets.
This may also be specified with the `build.target`
linkcargo:reference/config.html[config value].
--

View File

@ -0,0 +1,8 @@
*--lib*::
{actionverb} the package's library.
*--bin* _NAME_...::
{actionverb} the specified binary. This flag may be specified multiple times.
*--bins*::
{actionverb} all binary targets.

View File

@ -0,0 +1,33 @@
Passing target selection flags will convert:lowercase[{actionverb}] only the
specified targets.
include::options-targets-lib-bin.adoc[]
*--example* _NAME_...::
{actionverb} the specified example. This flag may be specified multiple times.
*--examples*::
{actionverb} all example targets.
*--test* _NAME_...::
{actionverb} the specified integration test. This flag may be specified multiple
times.
*--tests*::
{actionverb} all tests. This includes both unit tests for libraries and binaries
and integration tests. Targets may be disabled by setting `test = false`
in the manifest settings for the target. Targets (such as examples) may be
explicitly included by setting `test = true` in the target settings.
*--bench* _NAME_...::
{actionverb} the specified benchmark. This flag may be specified multiple times.
*--benches*::
{actionverb} all benchmarks. This includes both unit benchmarks for libraries and
binaries and bench targets. Targets may be disabled by setting `bench =
false` in the manifest settings for the target. Targets (such as examples)
may be explicitly included by setting `bench = true` in the target
settings.
*--all-targets*::
{actionverb} all targets.

View File

@ -0,0 +1,8 @@
*--no-run*::
Compile, but don't run {nouns}.
*--no-fail-fast*::
Run all {nouns} regardless of failure. Without this flag, Cargo will exit
after the first executable fails. The Rust test harness will run all
{nouns} within the executable to completion, this flag only applies to
the executable as a whole.

View File

@ -0,0 +1,2 @@
*--token* _TOKEN_::
API token to use when authenticating.

View File

@ -0,0 +1,4 @@
== ENVIRONMENT
See linkcargo:reference/environment-variables.html[the reference] for
details on environment variables that Cargo reads.

View File

@ -0,0 +1,7 @@
== Exit Status
0::
Cargo succeeded.
101::
Cargo failed to complete.

View File

@ -0,0 +1,24 @@
== PROFILES
Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
linkcargo:reference/manifest.html#the-profile-sections[the reference]
for more details.
Profile selection depends on the target and crate being built. By default the
`dev` or `test` profiles are used. If the `--release` flag is given, then the
`release` or `bench` profiles are used.
|===
|Target |Default Profile |`--release` Profile
|lib, bin, example
|`dev`
|`release`
|test, bench
|`test`
|`bench`
|===
Dependencies use the `dev`/`release` profiles.

View File

@ -29,5 +29,41 @@
* [External Tools](reference/external-tools.md)
* [Unstable Features](reference/unstable.md)
* [Cargo Commands](commands/index.md)
* [Build Commands](commands/build-commands.md)
* [bench](commands/cargo-bench.md)
* [build](commands/cargo-build.md)
* [check](commands/cargo-check.md)
* [clean](commands/cargo-clean.md)
* [doc](commands/cargo-doc.md)
* [fetch](commands/cargo-fetch.md)
* [fix](commands/cargo-fix.md)
* [run](commands/cargo-run.md)
* [rustc](commands/cargo-rustc.md)
* [rustdoc](commands/cargo-rustdoc.md)
* [test](commands/cargo-test.md)
* [Manifest Commands](commands/manifest-commands.md)
* [generate-lockfile](commands/cargo-generate-lockfile.md)
* [locate-project](commands/cargo-locate-project.md)
* [metadata](commands/cargo-metadata.md)
* [pkgid](commands/cargo-pkgid.md)
* [update](commands/cargo-update.md)
* [verify-project](commands/cargo-verify-project.md)
* [Package Commands](commands/package-commands.md)
* [init](commands/cargo-init.md)
* [install](commands/cargo-install.md)
* [new](commands/cargo-new.md)
* [search](commands/cargo-search.md)
* [uninstall](commands/cargo-uninstall.md)
* [Publishing Commands](commands/publishing-commands.md)
* [login](commands/cargo-login.md)
* [owner](commands/cargo-owner.md)
* [package](commands/cargo-package.md)
* [publish](commands/cargo-publish.md)
* [yank](commands/cargo-yank.md)
* [General Commands](commands/general-commands.md)
* [help](commands/cargo-help.md)
* [version](commands/cargo-version.md)
* [FAQ](faq.md)
* [Appendix: Glossary](appendix/glossary.md)

View File

@ -0,0 +1 @@
# Build Commands

View File

@ -0,0 +1,3 @@
# cargo bench
{{#include command-common.html}}
{{#include generated/cargo-bench.html}}

View File

@ -0,0 +1,3 @@
# cargo build
{{#include command-common.html}}
{{#include generated/cargo-build.html}}

View File

@ -0,0 +1,3 @@
# cargo check
{{#include command-common.html}}
{{#include generated/cargo-check.html}}

View File

@ -0,0 +1,3 @@
# cargo clean
{{#include command-common.html}}
{{#include generated/cargo-clean.html}}

View File

@ -0,0 +1,3 @@
# cargo doc
{{#include command-common.html}}
{{#include generated/cargo-doc.html}}

View File

@ -0,0 +1,3 @@
# cargo fetch
{{#include command-common.html}}
{{#include generated/cargo-fetch.html}}

View File

@ -0,0 +1,3 @@
# cargo fix
{{#include command-common.html}}
{{#include generated/cargo-fix.html}}

View File

@ -0,0 +1,3 @@
# cargo generate-lockfile
{{#include command-common.html}}
{{#include generated/cargo-generate-lockfile.html}}

View File

@ -0,0 +1,3 @@
# cargo help
{{#include command-common.html}}
{{#include generated/cargo-help.html}}

View File

@ -0,0 +1,3 @@
# cargo init
{{#include command-common.html}}
{{#include generated/cargo-init.html}}

View File

@ -0,0 +1,3 @@
# cargo install
{{#include command-common.html}}
{{#include generated/cargo-install.html}}

View File

@ -0,0 +1,3 @@
# cargo locate-project
{{#include command-common.html}}
{{#include generated/cargo-locate-project.html}}

View File

@ -0,0 +1,3 @@
# cargo login
{{#include command-common.html}}
{{#include generated/cargo-login.html}}

View File

@ -0,0 +1,3 @@
# cargo metadata
{{#include command-common.html}}
{{#include generated/cargo-metadata.html}}

View File

@ -0,0 +1,3 @@
# cargo new
{{#include command-common.html}}
{{#include generated/cargo-new.html}}

View File

@ -0,0 +1,3 @@
# cargo owner
{{#include command-common.html}}
{{#include generated/cargo-owner.html}}

View File

@ -0,0 +1,3 @@
# cargo package
{{#include command-common.html}}
{{#include generated/cargo-package.html}}

View File

@ -0,0 +1,3 @@
# cargo pkgid
{{#include command-common.html}}
{{#include generated/cargo-pkgid.html}}

View File

@ -0,0 +1,3 @@
# cargo publish
{{#include command-common.html}}
{{#include generated/cargo-publish.html}}

View File

@ -0,0 +1,3 @@
# cargo run
{{#include command-common.html}}
{{#include generated/cargo-run.html}}

View File

@ -0,0 +1,3 @@
# cargo rustc
{{#include command-common.html}}
{{#include generated/cargo-rustc.html}}

View File

@ -0,0 +1,3 @@
# cargo rustdoc
{{#include command-common.html}}
{{#include generated/cargo-rustdoc.html}}

View File

@ -0,0 +1,3 @@
# cargo search
{{#include command-common.html}}
{{#include generated/cargo-search.html}}

View File

@ -0,0 +1,3 @@
# cargo test
{{#include command-common.html}}
{{#include generated/cargo-test.html}}

View File

@ -0,0 +1,3 @@
# cargo uninstall
{{#include command-common.html}}
{{#include generated/cargo-uninstall.html}}

View File

@ -0,0 +1,3 @@
# cargo update
{{#include command-common.html}}
{{#include generated/cargo-update.html}}

View File

@ -0,0 +1,3 @@
# cargo verify-project
{{#include command-common.html}}
{{#include generated/cargo-verify-project.html}}

View File

@ -0,0 +1,3 @@
# cargo version
{{#include command-common.html}}
{{#include generated/cargo-version.html}}

View File

@ -0,0 +1,3 @@
# cargo yank
{{#include command-common.html}}
{{#include generated/cargo-yank.html}}

View File

@ -0,0 +1,18 @@
<style>
/* Include some space between definition elements. */
dd {
margin-bottom: 1em;
}
/* asciidoctor includes extra <p> tags which causes too much spacing. */
dd p {
margin-top: 0;
}
li p {
margin: 0;
}
/* asciidoctor uses a content class which conflicts with mdbook's content
class which causes too much spacing. */
.content {
padding-bottom: 0;
}
</style>

View File

@ -0,0 +1 @@
# General Commands

View File

@ -0,0 +1,487 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-bench - Execute benchmarks of a package</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo bench [<em>OPTIONS</em>] [BENCHNAME] [-- <em>BENCH-OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Compile and execute benchmarks.</p>
</div>
<div class="paragraph">
<p>The benchmark filtering argument <code>BENCHNAME</code> and all the arguments following
the two dashes (<code>--</code>) are passed to the benchmark binaries and thus to
<em>libtest</em> (rustc&#8217;s built in unit-test and micro-benchmarking framework). If
you&#8217;re passing arguments to both Cargo and the binary, the ones after <code>--</code> go
to the binary, the ones before go to Cargo. For details about libtest&#8217;s
arguments see the output of <code>cargo bench&#8201;&#8212;&#8201;--help</code>. As an example, this will
run only the benchmark named <code>foo</code> (and skip other similarly named benchmarks
like <code>foobar</code>):</p>
</div>
<div class="literalblock">
<div class="content">
<pre>cargo bench -- foo --exact</pre>
</div>
</div>
<div class="paragraph">
<p>Benchmarks are built with the <code>--test</code> option to <code>rustc</code> which creates an
executable with a <code>main</code> function that automatically runs all functions
annotated with the <code>#[bench]</code> attribute. The libtest harness may be disabled
by setting <code>harness = false</code> in the target manifest settings, in which case
your code will need to provide its own <code>main</code> function to handle running
benchmarks.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_benchmark_options">Benchmark Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--no-run</strong></dt>
<dd>
<p>Compile, but don&#8217;t run benchmarks.</p>
</dd>
<dt class="hdlist1"><strong>--no-fail-fast</strong></dt>
<dd>
<p>Run 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>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Benchmark only the specified packages. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the
SPEC format. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--all</strong></dt>
<dd>
<p>Benchmark all members in the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--exclude</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Exclude the specified packages. Must be used in conjunction with the
<code>--all</code> flag. This flag may be specified multiple times.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_target_selection">Target Selection</h3>
<div class="paragraph">
<p>When no target selection options are given, <code>cargo bench</code> will build the
following targets of the selected packages:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>lib used to link with binaries and benchmarks</p>
</li>
<li>
<p>bins (only if benchmark targets are built and required features are
available)</p>
</li>
<li>
<p>lib as a benchmark</p>
</li>
<li>
<p>bins as benchmarks</p>
</li>
<li>
<p>benchmark targets</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>The default behavior can be changed by setting the <code>bench</code> flag for the target
in the manifest settings. Setting examples to <code>bench = true</code> will build and
run the example as a benchmark. Setting targets to <code>bench = false</code> will stop
them from being benchmarked by default. Target selection options that take a
target by name ignore the <code>bench</code> flag and will always benchmark the given
target.</p>
</div>
<div class="paragraph">
<p>Passing target selection flags will benchmark only the
specified targets.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--lib</strong></dt>
<dd>
<p>Benchmark the package&#8217;s library.</p>
</dd>
<dt class="hdlist1"><strong>--bin</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Benchmark the specified binary. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--bins</strong></dt>
<dd>
<p>Benchmark all binary targets.</p>
</dd>
<dt class="hdlist1"><strong>--example</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Benchmark the specified example. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--examples</strong></dt>
<dd>
<p>Benchmark all example targets.</p>
</dd>
<dt class="hdlist1"><strong>--test</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Benchmark the specified integration test. This flag may be specified multiple
times.</p>
</dd>
<dt class="hdlist1"><strong>--tests</strong></dt>
<dd>
<p>Benchmark all tests. This includes both unit tests for libraries and binaries
and integration tests. Targets may be disabled by setting <code>test = false</code>
in the manifest settings for the target. Targets (such as examples) may be
explicitly included by setting <code>test = true</code> in the target settings.</p>
</dd>
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Benchmark the specified benchmark. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--benches</strong></dt>
<dd>
<p>Benchmark all benchmarks. This includes both unit benchmarks for libraries and
binaries and bench targets. Targets may be disabled by setting <code>bench =
false</code> in the manifest settings for the target. Targets (such as examples)
may be explicitly included by setting <code>bench = true</code> in the target
settings.</p>
</dd>
<dt class="hdlist1"><strong>--all-targets</strong></dt>
<dd>
<p>Benchmark all targets.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_feature_selection">Feature Selection</h3>
<div class="paragraph">
<p>When no feature options are given, the <code>default</code> feature is activated for
every selected package.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--features</strong> <em>FEATURES</em></dt>
<dd>
<p>Space or comma separated list of features to activate. These features only
apply to the current directory&#8217;s package. Features of direct dependencies
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
</dd>
<dt class="hdlist1"><strong>--all-features</strong></dt>
<dd>
<p>Activate all available features of all selected packages.</p>
</dd>
<dt class="hdlist1"><strong>--no-default-features</strong></dt>
<dd>
<p>Do not activate the <code>default</code> feature of the current directory&#8217;s
package.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_compilation_options">Compilation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Benchmark for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_output_options">Output Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="paragraph">
<p>By default the Rust test harness hides output from benchmark execution to keep
results readable. Benchmark output can be recovered (e.g. for debugging) by
passing <code>--nocapture</code> to the benchmark binaries:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>cargo bench -- --nocapture</pre>
</div>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
<dt class="hdlist1"><strong>--message-format</strong> <em>FMT</em></dt>
<dd>
<p>The output format for diagnostic messages. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>human</code> (default): Display in a human-readable text format.</p>
</li>
<li>
<p><code>json</code>: Emit JSON messages to stdout.</p>
</li>
<li>
<p><code>short</code>: Emit shorter, human-readable text messages.</p>
</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_miscellaneous_options">Miscellaneous Options</h3>
<div class="paragraph">
<p>The <code>--jobs</code> argument affects the building of the benchmark executable but
does not affect how many threads are used when running the benchmarks. The
Rust test harness runs benchmarks serially in a single thread.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-j</strong> <em>N</em></dt>
<dt class="hdlist1"><strong>--jobs</strong> <em>N</em></dt>
<dd>
<p>Number of parallel jobs to run. May also be specified with the
<code>build.jobs</code> <a href="reference/config.html">config value</a>. Defaults to
the number of CPUs.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_profiles">PROFILES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
<a href="reference/manifest.html#the-profile-sections">the reference</a>
for more details.</p>
</div>
<div class="paragraph">
<p>Benchmarks are always built with the <code>bench</code> profile. Binary and lib targets
are built separately as benchmarks with the <code>bench</code> profile. Library targets
are built with the <code>release</code> profiles when linked to binaries and benchmarks.
Dependencies use the <code>release</code> profile.</p>
</div>
<div class="paragraph">
<p>If you need a debug build of a benchmark, try building it with
<a href="commands/cargo-build.html">cargo-build(1)</a> which will use the <code>test</code> profile which is by default
unoptimized and includes debug information. You can then run the debug-enabled
benchmark manually.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Build and execute all the benchmarks of the current package:</p>
<div class="literalblock">
<div class="content">
<pre>cargo bench</pre>
</div>
</div>
</li>
<li>
<p>Run only a specific benchmark within a specific benchmark target:</p>
<div class="literalblock">
<div class="content">
<pre>cargo bench --bench bench_name -- modname::some_benchmark</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-test.html">cargo-test(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,448 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-build - Compile the current package</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo build [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Compile local packages and all of their dependencies.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Build only the specified packages. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the
SPEC format. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--all</strong></dt>
<dd>
<p>Build all members in the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--exclude</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Exclude the specified packages. Must be used in conjunction with the
<code>--all</code> flag. This flag may be specified multiple times.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_target_selection">Target Selection</h3>
<div class="paragraph">
<p>When no target selection options are given, <code>cargo build</code> will build all
binary and library targets of the selected packages. Binaries are skipped if
they have <code>required-features</code> that are missing.</p>
</div>
<div class="paragraph">
<p>Passing target selection flags will build only the
specified targets.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--lib</strong></dt>
<dd>
<p>Build the package&#8217;s library.</p>
</dd>
<dt class="hdlist1"><strong>--bin</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Build the specified binary. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--bins</strong></dt>
<dd>
<p>Build all binary targets.</p>
</dd>
<dt class="hdlist1"><strong>--example</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Build the specified example. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--examples</strong></dt>
<dd>
<p>Build all example targets.</p>
</dd>
<dt class="hdlist1"><strong>--test</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Build the specified integration test. This flag may be specified multiple
times.</p>
</dd>
<dt class="hdlist1"><strong>--tests</strong></dt>
<dd>
<p>Build all tests. This includes both unit tests for libraries and binaries
and integration tests. Targets may be disabled by setting <code>test = false</code>
in the manifest settings for the target. Targets (such as examples) may be
explicitly included by setting <code>test = true</code> in the target settings.</p>
</dd>
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Build the specified benchmark. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--benches</strong></dt>
<dd>
<p>Build all benchmarks. This includes both unit benchmarks for libraries and
binaries and bench targets. Targets may be disabled by setting <code>bench =
false</code> in the manifest settings for the target. Targets (such as examples)
may be explicitly included by setting <code>bench = true</code> in the target
settings.</p>
</dd>
<dt class="hdlist1"><strong>--all-targets</strong></dt>
<dd>
<p>Build all targets.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_feature_selection">Feature Selection</h3>
<div class="paragraph">
<p>When no feature options are given, the <code>default</code> feature is activated for
every selected package.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--features</strong> <em>FEATURES</em></dt>
<dd>
<p>Space or comma separated list of features to activate. These features only
apply to the current directory&#8217;s package. Features of direct dependencies
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
</dd>
<dt class="hdlist1"><strong>--all-features</strong></dt>
<dd>
<p>Activate all available features of all selected packages.</p>
</dd>
<dt class="hdlist1"><strong>--no-default-features</strong></dt>
<dd>
<p>Do not activate the <code>default</code> feature of the current directory&#8217;s
package.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_compilation_options">Compilation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Build for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
<dt class="hdlist1"><strong>--release</strong></dt>
<dd>
<p>Build artifacts in release mode, with optimizations. See the
<a href="#_profiles">PROFILES</a> section for details on how this affects profile selection.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_output_options">Output Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--out-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Copy final artifacts to this directory.</p>
<div class="paragraph">
<p>This option is unstable and available only on the nightly channel and requires
the <code>-Z unstable-options</code> flag to enable.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
<dt class="hdlist1"><strong>--message-format</strong> <em>FMT</em></dt>
<dd>
<p>The output format for diagnostic messages. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>human</code> (default): Display in a human-readable text format.</p>
</li>
<li>
<p><code>json</code>: Emit JSON messages to stdout.</p>
</li>
<li>
<p><code>short</code>: Emit shorter, human-readable text messages.</p>
</li>
</ul>
</div>
</dd>
<dt class="hdlist1"><strong>--build-plan</strong></dt>
<dd>
<p>Outputs a series of JSON messages to stdout that indicate the commands to
run the build.</p>
<div class="paragraph">
<p>This option is unstable and available only on the nightly channel and requires
the <code>-Z unstable-options</code> flag to enable.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_miscellaneous_options">Miscellaneous Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-j</strong> <em>N</em></dt>
<dt class="hdlist1"><strong>--jobs</strong> <em>N</em></dt>
<dd>
<p>Number of parallel jobs to run. May also be specified with the
<code>build.jobs</code> <a href="reference/config.html">config value</a>. Defaults to
the number of CPUs.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_profiles">PROFILES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
<a href="reference/manifest.html#the-profile-sections">the reference</a>
for more details.</p>
</div>
<div class="paragraph">
<p>Profile selection depends on the target and crate being built. By default the
<code>dev</code> or <code>test</code> profiles are used. If the <code>--release</code> flag is given, then the
<code>release</code> or <code>bench</code> profiles are used.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Target</th>
<th class="tableblock halign-left valign-top">Default Profile</th>
<th class="tableblock halign-left valign-top"><code>--release</code> Profile</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lib, bin, example</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>dev</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>release</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>test</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bench</code></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Dependencies use the <code>dev</code>/<code>release</code> profiles.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Build the local package and all of its dependencies:</p>
<div class="literalblock">
<div class="content">
<pre>cargo build</pre>
</div>
</div>
</li>
<li>
<p>Build with optimizations:</p>
<div class="literalblock">
<div class="content">
<pre>cargo build --release</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-rustc.html">cargo-rustc(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,443 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-check - Check the current package</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo check [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Check a local package and all of its dependencies for errors. This will
essentially compile the packages without performing the final step of code
generation, which is faster than running <code>cargo build</code>. The compiler will save
metadata files to disk so that future runs will reuse them if the source has
not been modified.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Check only the specified packages. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the
SPEC format. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--all</strong></dt>
<dd>
<p>Check all members in the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--exclude</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Exclude the specified packages. Must be used in conjunction with the
<code>--all</code> flag. This flag may be specified multiple times.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_target_selection">Target Selection</h3>
<div class="paragraph">
<p>When no target selection options are given, <code>cargo check</code> will check all
binary and library targets of the selected packages. Binaries are skipped if
they have <code>required-features</code> that are missing.</p>
</div>
<div class="paragraph">
<p>Passing target selection flags will check only the
specified targets.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--lib</strong></dt>
<dd>
<p>Check the package&#8217;s library.</p>
</dd>
<dt class="hdlist1"><strong>--bin</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Check the specified binary. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--bins</strong></dt>
<dd>
<p>Check all binary targets.</p>
</dd>
<dt class="hdlist1"><strong>--example</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Check the specified example. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--examples</strong></dt>
<dd>
<p>Check all example targets.</p>
</dd>
<dt class="hdlist1"><strong>--test</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Check the specified integration test. This flag may be specified multiple
times.</p>
</dd>
<dt class="hdlist1"><strong>--tests</strong></dt>
<dd>
<p>Check all tests. This includes both unit tests for libraries and binaries
and integration tests. Targets may be disabled by setting <code>test = false</code>
in the manifest settings for the target. Targets (such as examples) may be
explicitly included by setting <code>test = true</code> in the target settings.</p>
</dd>
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Check the specified benchmark. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--benches</strong></dt>
<dd>
<p>Check all benchmarks. This includes both unit benchmarks for libraries and
binaries and bench targets. Targets may be disabled by setting <code>bench =
false</code> in the manifest settings for the target. Targets (such as examples)
may be explicitly included by setting <code>bench = true</code> in the target
settings.</p>
</dd>
<dt class="hdlist1"><strong>--all-targets</strong></dt>
<dd>
<p>Check all targets.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_feature_selection">Feature Selection</h3>
<div class="paragraph">
<p>When no feature options are given, the <code>default</code> feature is activated for
every selected package.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--features</strong> <em>FEATURES</em></dt>
<dd>
<p>Space or comma separated list of features to activate. These features only
apply to the current directory&#8217;s package. Features of direct dependencies
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
</dd>
<dt class="hdlist1"><strong>--all-features</strong></dt>
<dd>
<p>Activate all available features of all selected packages.</p>
</dd>
<dt class="hdlist1"><strong>--no-default-features</strong></dt>
<dd>
<p>Do not activate the <code>default</code> feature of the current directory&#8217;s
package.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_compilation_options">Compilation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Check for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
<dt class="hdlist1"><strong>--release</strong></dt>
<dd>
<p>Check artifacts in release mode, with optimizations. See the
<a href="#_profiles">PROFILES</a> section for details on how this affects profile selection.</p>
</dd>
<dt class="hdlist1"><strong>--profile</strong> <em>NAME</em></dt>
<dd>
<p>Changes check behavior. Currently only <code>test</code> is
supported, which will check with the
<code>#[cfg(test)]</code> attribute enabled. This is useful to have it
check unit tests which are usually excluded via
the <code>cfg</code> attribute. This does not change the actual profile used.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_output_options">Output Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
<dt class="hdlist1"><strong>--message-format</strong> <em>FMT</em></dt>
<dd>
<p>The output format for diagnostic messages. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>human</code> (default): Display in a human-readable text format.</p>
</li>
<li>
<p><code>json</code>: Emit JSON messages to stdout.</p>
</li>
<li>
<p><code>short</code>: Emit shorter, human-readable text messages.</p>
</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_miscellaneous_options">Miscellaneous Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-j</strong> <em>N</em></dt>
<dt class="hdlist1"><strong>--jobs</strong> <em>N</em></dt>
<dd>
<p>Number of parallel jobs to run. May also be specified with the
<code>build.jobs</code> <a href="reference/config.html">config value</a>. Defaults to
the number of CPUs.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_profiles">PROFILES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
<a href="reference/manifest.html#the-profile-sections">the reference</a>
for more details.</p>
</div>
<div class="paragraph">
<p>Profile selection depends on the target and crate being built. By default the
<code>dev</code> or <code>test</code> profiles are used. If the <code>--release</code> flag is given, then the
<code>release</code> or <code>bench</code> profiles are used.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Target</th>
<th class="tableblock halign-left valign-top">Default Profile</th>
<th class="tableblock halign-left valign-top"><code>--release</code> Profile</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lib, bin, example</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>dev</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>release</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>test</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bench</code></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Dependencies use the <code>dev</code>/<code>release</code> profiles.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Check the local package for errors:</p>
<div class="literalblock">
<div class="content">
<pre>cargo check</pre>
</div>
</div>
</li>
<li>
<p>Check all targets, including unit tests:</p>
<div class="literalblock">
<div class="content">
<pre>cargo check --all-targets --profile=test</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-build.html">cargo-build(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,254 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-clean - Remove generated artifacts</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo clean [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Remove artifacts from the target directory that Cargo has generated in the
past.</p>
</div>
<div class="paragraph">
<p>With no options, <code>cargo clean</code> will delete the entire target directory.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>When no packages are selected, all packages and all dependencies in the
workspace are cleaned.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Clean only the specified packages. This flag may be specified
multiple times. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the SPEC format.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_clean_options">Clean Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--doc</strong></dt>
<dd>
<p>This option will cause <code>cargo clean</code> to remove only the <code>doc</code> directory in
the target directory.</p>
</dd>
<dt class="hdlist1"><strong>--release</strong></dt>
<dd>
<p>Clean all artifacts that were built with the <code>release</code> or <code>bench</code>
profiles.</p>
</dd>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Clean for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Remove the entire target directory:</p>
<div class="literalblock">
<div class="content">
<pre>cargo clean</pre>
</div>
</div>
</li>
<li>
<p>Remove only the release artifacts:</p>
<div class="literalblock">
<div class="content">
<pre>cargo clean --release</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-build.html">cargo-build(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,410 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-doc - Build a package's documentation</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo doc [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Build the documentation for the local package and all dependencies. The output
is placed in <code>target/doc</code> in rustdoc&#8217;s usual format.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_documentation_options">Documentation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--open</strong></dt>
<dd>
<p>Open the docs in a browser after building them.</p>
</dd>
<dt class="hdlist1"><strong>--no-deps</strong></dt>
<dd>
<p>Do not build documentation for dependencies.</p>
</dd>
<dt class="hdlist1"><strong>--document-private-items</strong></dt>
<dd>
<p>Include non-public items in the documentation.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Document only the specified packages. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the
SPEC format. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--all</strong></dt>
<dd>
<p>Document all members in the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--exclude</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Exclude the specified packages. Must be used in conjunction with the
<code>--all</code> flag. This flag may be specified multiple times.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_target_selection">Target Selection</h3>
<div class="paragraph">
<p>When no target selection options are given, <code>cargo doc</code> will document all
binary and library targets of the selected package. The binary will be skipped
if its name is the same as the lib target. Binaries are skipped if they have
<code>required-features</code> that are missing.</p>
</div>
<div class="paragraph">
<p>The default behavior can be changed by setting <code>doc = false</code> for the target in
the manifest settings. Using target selection options will ignore the <code>doc</code>
flag and will always document the given target.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--lib</strong></dt>
<dd>
<p>Document the package&#8217;s library.</p>
</dd>
<dt class="hdlist1"><strong>--bin</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Document the specified binary. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--bins</strong></dt>
<dd>
<p>Document all binary targets.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_feature_selection">Feature Selection</h3>
<div class="paragraph">
<p>When no feature options are given, the <code>default</code> feature is activated for
every selected package.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--features</strong> <em>FEATURES</em></dt>
<dd>
<p>Space or comma separated list of features to activate. These features only
apply to the current directory&#8217;s package. Features of direct dependencies
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
</dd>
<dt class="hdlist1"><strong>--all-features</strong></dt>
<dd>
<p>Activate all available features of all selected packages.</p>
</dd>
<dt class="hdlist1"><strong>--no-default-features</strong></dt>
<dd>
<p>Do not activate the <code>default</code> feature of the current directory&#8217;s
package.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_compilation_options">Compilation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Document for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
<dt class="hdlist1"><strong>--release</strong></dt>
<dd>
<p>Document artifacts in release mode, with optimizations. See the
<a href="#_profiles">PROFILES</a> section for details on how this affects profile selection.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_output_options">Output Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
<dt class="hdlist1"><strong>--message-format</strong> <em>FMT</em></dt>
<dd>
<p>The output format for diagnostic messages. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>human</code> (default): Display in a human-readable text format.</p>
</li>
<li>
<p><code>json</code>: Emit JSON messages to stdout.</p>
</li>
<li>
<p><code>short</code>: Emit shorter, human-readable text messages.</p>
</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_miscellaneous_options">Miscellaneous Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-j</strong> <em>N</em></dt>
<dt class="hdlist1"><strong>--jobs</strong> <em>N</em></dt>
<dd>
<p>Number of parallel jobs to run. May also be specified with the
<code>build.jobs</code> <a href="reference/config.html">config value</a>. Defaults to
the number of CPUs.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_profiles">PROFILES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
<a href="reference/manifest.html#the-profile-sections">the reference</a>
for more details.</p>
</div>
<div class="paragraph">
<p>Profile selection depends on the target and crate being built. By default the
<code>dev</code> or <code>test</code> profiles are used. If the <code>--release</code> flag is given, then the
<code>release</code> or <code>bench</code> profiles are used.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Target</th>
<th class="tableblock halign-left valign-top">Default Profile</th>
<th class="tableblock halign-left valign-top"><code>--release</code> Profile</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lib, bin, example</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>dev</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>release</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>test</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bench</code></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Dependencies use the <code>dev</code>/<code>release</code> profiles.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Build the local package documentation and its dependencies and output to
<code>target/doc</code>.</p>
<div class="literalblock">
<div class="content">
<pre>cargo doc</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-rustdoc.html">cargo-rustdoc(1)</a>, <a href="https://doc.rust-lang.org/rustdoc/index.html">rustdoc(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,218 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-fetch - Fetch dependencies of a package from the network</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo fetch [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>If a <code>Cargo.lock</code> file is available, this command will ensure that all of the
git dependencies and/or registry dependencies are downloaded and locally
available. Subsequent Cargo commands never touch the network after a <code>cargo
fetch</code> unless the lock file changes.</p>
</div>
<div class="paragraph">
<p>If the lock file is not available, then this command will generate the lock
file before fetching the dependencies.</p>
</div>
<div class="paragraph">
<p>If <code>--target</code> is not specified, then all target dependencies are fetched.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_fetch_options">Fetch options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Fetch for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Fetch all dependencies:</p>
<div class="literalblock">
<div class="content">
<pre>cargo fetch</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-update.html">cargo-update(1)</a>, <a href="commands/cargo-generate-lockfile.html">cargo-generate-lockfile(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,522 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-fix - Automatically fix lint warnings reported by rustc</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo fix [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This Cargo subcommand will automatically take rustc&#8217;s suggestions from
diagnostics like warnings and apply them to your source code. This is intended
to help automate tasks that rustc itself already knows how to tell you to fix!
The <code>cargo fix</code> subcommand is also being developed for the Rust 2018 edition
to provide code the ability to easily opt-in to the new edition without having
to worry about any breakage.</p>
</div>
<div class="paragraph">
<p>Executing <code>cargo fix</code> will under the hood execute <a href="commands/cargo-check.html">cargo-check(1)</a>. Any warnings
applicable to your crate will be automatically fixed (if possible) and all
remaining warnings will be displayed when the check process is finished. For
example if you&#8217;d like to prepare for the 2018 edition, you can do so by
executing:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>cargo fix --edition</pre>
</div>
</div>
<div class="paragraph">
<p>which behaves the same as <code>cargo check --all-targets</code>. Similarly if you&#8217;d like
to fix code for different platforms you can do:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>cargo fix --edition --target x86_64-pc-windows-gnu</pre>
</div>
</div>
<div class="paragraph">
<p>or if your crate has optional features:</p>
</div>
<div class="literalblock">
<div class="content">
<pre>cargo fix --edition --no-default-features --features foo</pre>
</div>
</div>
<div class="paragraph">
<p>If you encounter any problems with <code>cargo fix</code> or otherwise have any questions
or feature requests please don&#8217;t hesitate to file an issue at
<a href="https://github.com/rust-lang/cargo" class="bare">https://github.com/rust-lang/cargo</a></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_fix_options">Fix options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--broken-code</strong></dt>
<dd>
<p>Fix code even if it already has compiler errors. This is useful if <code>cargo
fix</code> 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.</p>
</dd>
<dt class="hdlist1"><strong>--edition</strong></dt>
<dd>
<p>Apply changes that will update the code to the latest edition. This will
not update the edition in the <code>Cargo.toml</code> manifest, which must be updated
manually.</p>
</dd>
<dt class="hdlist1"><strong>--edition-idioms</strong></dt>
<dd>
<p>Apply suggestions that will update code to the preferred style for the
current edition.</p>
</dd>
<dt class="hdlist1"><strong>--allow-no-vcs</strong></dt>
<dd>
<p>Fix code even if a VCS was not detected.</p>
</dd>
<dt class="hdlist1"><strong>--allow-dirty</strong></dt>
<dd>
<p>Fix code even if the working directory has changes.</p>
</dd>
<dt class="hdlist1"><strong>--allow-staged</strong></dt>
<dd>
<p>Fix code even if the working directory has staged changes.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_package_selection">Package Selection</h3>
<div class="paragraph">
<p>By default, when no package selection options are given, the packages selected
depend on the current working directory. In the root of a virtual workspace,
all workspace members are selected (<code>--all</code> is implied). Otherwise, only the
package in the current directory will be selected. The default packages may be
overridden with the <code>workspace.default-members</code> key in the root <code>Cargo.toml</code>
manifest.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-p</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dt class="hdlist1"><strong>--package</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Fix only the specified packages. See <a href="commands/cargo-pkgid.html">cargo-pkgid(1)</a> for the
SPEC format. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--all</strong></dt>
<dd>
<p>Fix all members in the workspace.</p>
</dd>
<dt class="hdlist1"><strong>--exclude</strong> <em>SPEC</em>&#8230;&#8203;</dt>
<dd>
<p>Exclude the specified packages. Must be used in conjunction with the
<code>--all</code> flag. This flag may be specified multiple times.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_target_selection">Target Selection</h3>
<div class="paragraph">
<p>When no target selection options are given, <code>cargo fix</code> will fix all targets
(<code>--all-targets</code> implied). Binaries are skipped if they have
<code>required-features</code> that are missing.</p>
</div>
<div class="paragraph">
<p>Passing target selection flags will fix only the
specified targets.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--lib</strong></dt>
<dd>
<p>Fix the package&#8217;s library.</p>
</dd>
<dt class="hdlist1"><strong>--bin</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Fix the specified binary. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--bins</strong></dt>
<dd>
<p>Fix all binary targets.</p>
</dd>
<dt class="hdlist1"><strong>--example</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Fix the specified example. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--examples</strong></dt>
<dd>
<p>Fix all example targets.</p>
</dd>
<dt class="hdlist1"><strong>--test</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Fix the specified integration test. This flag may be specified multiple
times.</p>
</dd>
<dt class="hdlist1"><strong>--tests</strong></dt>
<dd>
<p>Fix all tests. This includes both unit tests for libraries and binaries
and integration tests. Targets may be disabled by setting <code>test = false</code>
in the manifest settings for the target. Targets (such as examples) may be
explicitly included by setting <code>test = true</code> in the target settings.</p>
</dd>
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
<dd>
<p>Fix the specified benchmark. This flag may be specified multiple times.</p>
</dd>
<dt class="hdlist1"><strong>--benches</strong></dt>
<dd>
<p>Fix all benchmarks. This includes both unit benchmarks for libraries and
binaries and bench targets. Targets may be disabled by setting <code>bench =
false</code> in the manifest settings for the target. Targets (such as examples)
may be explicitly included by setting <code>bench = true</code> in the target
settings.</p>
</dd>
<dt class="hdlist1"><strong>--all-targets</strong></dt>
<dd>
<p>Fix all targets.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_feature_selection">Feature Selection</h3>
<div class="paragraph">
<p>When no feature options are given, the <code>default</code> feature is activated for
every selected package.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--features</strong> <em>FEATURES</em></dt>
<dd>
<p>Space or comma separated list of features to activate. These features only
apply to the current directory&#8217;s package. Features of direct dependencies
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
</dd>
<dt class="hdlist1"><strong>--all-features</strong></dt>
<dd>
<p>Activate all available features of all selected packages.</p>
</dd>
<dt class="hdlist1"><strong>--no-default-features</strong></dt>
<dd>
<p>Do not activate the <code>default</code> feature of the current directory&#8217;s
package.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_compilation_options">Compilation Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
<dd>
<p>Fix for the given architecture. The default is the host architecture.</p>
<div class="paragraph">
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
<code>thumb</code>, <code>mips</code>, etc.</p>
</li>
<li>
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
etc.</p>
</li>
<li>
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
</li>
<li>
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
typically used for bare-metal without an OS.</p>
</li>
<li>
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
</li>
</ul>
</div>
<div class="openblock">
<div class="content">
<div class="paragraph">
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
supported targets.</p>
</div>
<div class="paragraph">
<p>This may also be specified with the <code>build.target</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</div>
</div>
</dd>
<dt class="hdlist1"><strong>--release</strong></dt>
<dd>
<p>Fix artifacts in release mode, with optimizations. See the
<a href="#_profiles">PROFILES</a> section for details on how this affects profile selection.</p>
</dd>
<dt class="hdlist1"><strong>--profile</strong> <em>NAME</em></dt>
<dd>
<p>Changes fix behavior. Currently only <code>test</code> is
supported, which will fix with the
<code>#[cfg(test)]</code> attribute enabled. This is useful to have it
fix unit tests which are usually excluded via
the <code>cfg</code> attribute. This does not change the actual profile used.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_output_options">Output Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
<dd>
<p>Directory for all generated artifacts and intermediate files. May also be
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
<code>build.target-dir</code> <a href="reference/config.html">config value</a>. Defaults
to <code>target</code> in the root of the workspace.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
<dt class="hdlist1"><strong>--message-format</strong> <em>FMT</em></dt>
<dd>
<p>The output format for diagnostic messages. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>human</code> (default): Display in a human-readable text format.</p>
</li>
<li>
<p><code>json</code>: Emit JSON messages to stdout.</p>
</li>
<li>
<p><code>short</code>: Emit shorter, human-readable text messages.</p>
</li>
</ul>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_miscellaneous_options">Miscellaneous Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-j</strong> <em>N</em></dt>
<dt class="hdlist1"><strong>--jobs</strong> <em>N</em></dt>
<dd>
<p>Number of parallel jobs to run. May also be specified with the
<code>build.jobs</code> <a href="reference/config.html">config value</a>. Defaults to
the number of CPUs.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_profiles">PROFILES</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Profiles may be used to configure compiler options such as optimization levels
and debug settings. See
<a href="reference/manifest.html#the-profile-sections">the reference</a>
for more details.</p>
</div>
<div class="paragraph">
<p>Profile selection depends on the target and crate being built. By default the
<code>dev</code> or <code>test</code> profiles are used. If the <code>--release</code> flag is given, then the
<code>release</code> or <code>bench</code> profiles are used.</p>
</div>
<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Target</th>
<th class="tableblock halign-left valign-top">Default Profile</th>
<th class="tableblock halign-left valign-top"><code>--release</code> Profile</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">lib, bin, example</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>dev</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>release</code></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>test</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bench</code></p></td>
</tr>
</tbody>
</table>
<div class="paragraph">
<p>Dependencies use the <code>dev</code>/<code>release</code> profiles.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Apply compiler suggestions to the local package:</p>
<div class="literalblock">
<div class="content">
<pre>cargo fix</pre>
</div>
</div>
</li>
<li>
<p>Convert a 2015 edition to 2018:</p>
<div class="literalblock">
<div class="content">
<pre>cargo fix --edition</pre>
</div>
</div>
</li>
<li>
<p>Apply suggested idioms for the current edition:</p>
<div class="literalblock">
<div class="content">
<pre>cargo fix --edition-idioms</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-check.html">cargo-check(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,166 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-generate-lockfile - Generate the lockfile for a package</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo generate-lockfile [<em>OPTIONS</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This command will create the <code>Cargo.lock</code> lockfile for the current package or
workspace. If the lockfile already exists, it will be rebuilt if there are any
manifest changes or dependency updates.</p>
</div>
<div class="paragraph">
<p>See also <a href="commands/cargo-update.html">cargo-update(1)</a> which is also capable of creating a <code>Cargo.lock</code>
lockfile and has more options for controlling update behavior.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_options">OPTIONS</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_display_options">Display Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-v</strong></dt>
<dt class="hdlist1"><strong>--verbose</strong></dt>
<dd>
<p>Use 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 <code>term.verbose</code>
<a href="reference/config.html">config value</a>.</p>
</dd>
<dt class="hdlist1"><strong>-q</strong></dt>
<dt class="hdlist1"><strong>--quiet</strong></dt>
<dd>
<p>No output printed to stdout.</p>
</dd>
<dt class="hdlist1"><strong>--color</strong> <em>WHEN</em></dt>
<dd>
<p>Control when colored output is used. Valid values:</p>
<div class="ulist">
<ul>
<li>
<p><code>auto</code> (default): Automatically detect if color support is available on the
terminal.</p>
</li>
<li>
<p><code>always</code>: Always display colors.</p>
</li>
<li>
<p><code>never</code>: Never display colors.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>May also be specified with the <code>term.color</code>
<a href="reference/config.html">config value</a>.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_manifest_options">Manifest Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>--manifest-path</strong> <em>PATH</em></dt>
<dd>
<p>Path to the <code>Cargo.toml</code> file. By default, Cargo searches in the current
directory or any parent directory for the <code>Cargo.toml</code> file.</p>
</dd>
<dt class="hdlist1"><strong>--frozen</strong></dt>
<dt class="hdlist1"><strong>--locked</strong></dt>
<dd>
<p>Either of these flags requires that the <code>Cargo.lock</code> file is
up-to-date. If the lock file is missing, or it needs to be updated, Cargo will
exit with an error. The <code>--frozen</code> flag also prevents Cargo from
attempting to access the network to determine if it is out-of-date.</p>
<div class="paragraph">
<p>These may be used in environments where you want to assert that the
<code>Cargo.lock</code> file is up-to-date (such as a CI build) or want to avoid network
access.</p>
</div>
</dd>
</dl>
</div>
</div>
<div class="sect2">
<h3 id="_common_options">Common Options</h3>
<div class="dlist">
<dl>
<dt class="hdlist1"><strong>-h</strong></dt>
<dt class="hdlist1"><strong>--help</strong></dt>
<dd>
<p>Prints help information.</p>
</dd>
<dt class="hdlist1"><strong>-Z</strong> <em>FLAG</em>&#8230;&#8203;</dt>
<dd>
<p>Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for
details.</p>
</dd>
</dl>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_environment">ENVIRONMENT</h2>
<div class="sectionbody">
<div class="paragraph">
<p>See <a href="reference/environment-variables.html">the reference</a> for
details on environment variables that Cargo reads.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_exit_status">Exit Status</h2>
<div class="sectionbody">
<div class="dlist">
<dl>
<dt class="hdlist1">0</dt>
<dd>
<p>Cargo succeeded.</p>
</dd>
<dt class="hdlist1">101</dt>
<dd>
<p>Cargo failed to complete.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Create or update the lockfile for the current package or workspace:</p>
<div class="literalblock">
<div class="content">
<pre>cargo generate-lockfile</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a>, <a href="commands/cargo-update.html">cargo-update(1)</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,53 @@
<h2 id="_name">NAME</h2>
<div class="sectionbody">
<p>cargo-help - Get help for a Cargo command</p>
</div>
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="paragraph">
<p><code>cargo help [<em>SUBCOMMAND</em>]</code></p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_description">DESCRIPTION</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Prints a help message for the given command.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_examples">EXAMPLES</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Get help for a command:</p>
<div class="literalblock">
<div class="content">
<pre>cargo help build</pre>
</div>
</div>
</li>
<li>
<p>Help is also available with the <code>--help</code> flag:</p>
<div class="literalblock">
<div class="content">
<pre>cargo build --help</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="commands/index.html">cargo(1)</a></p>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More