diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md
index 582ca4914fb..daf29ab1c6a 100644
--- a/src/doc/src/commands/cargo-bench.md
+++ b/src/doc/src/commands/cargo-bench.md
@@ -98,7 +98,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Benchmark only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md
index 4c106ffeba1..fff6a45dae3 100644
--- a/src/doc/src/commands/cargo-build.md
+++ b/src/doc/src/commands/cargo-build.md
@@ -32,7 +32,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Build only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md
index 25771fb9120..b90672c8eee 100644
--- a/src/doc/src/commands/cargo-check.md
+++ b/src/doc/src/commands/cargo-check.md
@@ -37,7 +37,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Check only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md
index 7eb518ec9f5..b3370c82fa7 100644
--- a/src/doc/src/commands/cargo-doc.md
+++ b/src/doc/src/commands/cargo-doc.md
@@ -54,7 +54,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Document only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md
index f53f44ae75f..bc9dc76a688 100644
--- a/src/doc/src/commands/cargo-fix.md
+++ b/src/doc/src/commands/cargo-fix.md
@@ -117,7 +117,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Fix only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-install.md b/src/doc/src/commands/cargo-install.md
index fd9b561fa50..f4b7a611604 100644
--- a/src/doc/src/commands/cargo-install.md
+++ b/src/doc/src/commands/cargo-install.md
@@ -222,7 +222,7 @@ target artifacts are placed in a separate directory. See the
specified with the CARGO_TARGET_DIR environment variable, or the
build.target-dirconfig value.
Defaults to a new temporary folder located in the
-temporary directory of the platform.
+temporary directory of the platform.
When using --path, by default it will use target directory in the workspace
of the local crate unless --target-dir
is specified.
diff --git a/src/doc/src/commands/cargo-metadata.md b/src/doc/src/commands/cargo-metadata.md
index 3af0bb953f0..6d170eb9267 100644
--- a/src/doc/src/commands/cargo-metadata.md
+++ b/src/doc/src/commands/cargo-metadata.md
@@ -352,7 +352,7 @@ possible value.
--filter-platformtriple
This filters the resolve output to only include dependencies for the
-given target triple.
+given target triple.
Without this flag, the resolve includes all targets.
Note that the dependencies listed in the “packages” array still includes all
dependencies. Each package definition is intended to be an unaltered
diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md
index 376f8140b60..aa64b8649ed 100644
--- a/src/doc/src/commands/cargo-package.md
+++ b/src/doc/src/commands/cargo-package.md
@@ -101,7 +101,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Package only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index 54a9f28cc4f..dd7727acc66 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -106,7 +106,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Test only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/commands/cargo-tree.md b/src/doc/src/commands/cargo-tree.md
index 2bbe546da67..ec930581706 100644
--- a/src/doc/src/commands/cargo-tree.md
+++ b/src/doc/src/commands/cargo-tree.md
@@ -134,7 +134,7 @@ kind given, then it will automatically include the other dependency kinds.
--targettriple
-
Filter dependencies matching the given target triple.
+
Filter dependencies matching the given target triple.
The default is the host platform. Use the value all to include all targets.
@@ -193,7 +193,7 @@ virtual workspace will include all workspace members (equivalent to passing
--packagespec…
Display only the specified packages. See cargo-pkgid(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like *, ? and []. However, to avoid your shell accidentally
+glob patterns like *, ? and []. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
diff --git a/src/doc/src/reference/specifying-dependencies.md b/src/doc/src/reference/specifying-dependencies.md
index bdede1e1d32..9ef98e22a01 100644
--- a/src/doc/src/reference/specifying-dependencies.md
+++ b/src/doc/src/reference/specifying-dependencies.md
@@ -51,7 +51,9 @@ versions before 1.0.0. While SemVer says there is no compatibility before
and `x > 0`.
It is possible to further tweak the logic for selecting compatible versions
-using special operators, though it shouldn't be necessary most of the time.
+using special operators as described in the [Version requirement syntax](#version-requirement-syntax) section.
+
+Use the default version requirement strategy, e.g. `log = "1.2.3"` where possible to maximize compatibility.
## Version requirement syntax
@@ -158,16 +160,17 @@ separated with a comma, e.g., `>= 1.2, < 1.5`.
## Specifying dependencies from other registries
-To specify a dependency from a registry other than [crates.io], first the
-registry must be configured in a `.cargo/config.toml` file. See the [registries
-documentation] for more information. In the dependency, set the `registry` key
-to the name of the registry to use.
+To specify a dependency from a registry other than [crates.io] set the `registry` key
+to the name of the registry to use:
```toml
[dependencies]
some-crate = { version = "1.0", registry = "my-registry" }
```
+where `my-registry` is the registry name configured in `.cargo/config.toml` file.
+See the [registries documentation] for more information.
+
> **Note**: [crates.io] does not allow packages to be published with
> dependencies on code published outside of [crates.io].
@@ -183,45 +186,87 @@ you need to specify is the location of the repository with the `git` key:
regex = { git = "https://github.com/rust-lang/regex.git" }
```
-Cargo will fetch the `git` repository at this location then look for a
-`Cargo.toml` for the requested crate anywhere inside the `git` repository
-(not necessarily at the root --- for example, specifying a member crate name
-of a workspace and setting `git` to the repository containing the workspace).
+Cargo fetches the `git` repository at that location and traverses the file tree to find
+`Cargo.toml` file for the requested crate anywhere inside the `git` repository.
+For example, `regex-lite` and `regex-syntax` are members of `rust-lang/regex` repo
+and can be referred to by the repo's root URL (`https://github.com/rust-lang/regex.git`)
+regardless of where in the file tree they reside.
+
+```toml
+regex-lite = { git = "https://github.com/rust-lang/regex.git" }
+regex-syntax = { git = "https://github.com/rust-lang/regex.git" }
+```
+
+The above rule does not apply to [`path` dependencies](#specifying-path-dependencies).
-Since we haven’t specified any other information, Cargo assumes that
-we intend to use the latest commit on the default branch to build
-our package, which may not necessarily be the main branch.
-You can combine the `git` key with the `rev`, `tag`, or `branch` keys to
-specify something else. Here's an example of specifying that you want to use
-the latest commit on a branch named `next`:
+### Choice of commit
+
+Cargo assumes that we intend to use the latest commit on the default branch to build
+our package if we only specify the repo URL, as in the examples above.
+
+You can combine the `git` key with the `rev`, `tag`, or `branch` keys to be more specific about
+which commit to use. Here's an example of using the latest commit on a branch named `next`:
```toml
[dependencies]
regex = { git = "https://github.com/rust-lang/regex.git", branch = "next" }
```
-Anything that is not a branch or tag falls under `rev`. This can be a commit
+Anything that is not a branch or a tag falls under `rev` key. This can be a commit
hash like `rev = "4c59b707"`, or a named reference exposed by the remote
-repository such as `rev = "refs/pull/493/head"`. What references are available
-varies by where the repo is hosted; GitHub in particular exposes a reference to
-the most recent commit of every pull request as shown, but other git hosts often
-provide something equivalent, possibly under a different naming scheme.
-
-Once a `git` dependency has been added, Cargo will lock that dependency to the
-latest commit at the time. New commits will not be pulled down automatically
-once the lock is in place. However, they can be pulled down manually with
-`cargo update`.
-
-See [Git Authentication] for help with git authentication for private repos.
-
-> **Note**: Neither the `git` key nor the `path` key changes the meaning of the
-> `version` key: the `version` key always implies that the package is available
-> in a registry. `version`, `git`, and `path` keys are considered [separate
-> locations](#multiple-locations) for resolving the dependency.
->
-> When the dependency is retrieved from `git`, the `version` key will _not_
-> affect which commit is used, but the version information in the dependency's
-> `Cargo.toml` file will still be validated against the `version` requirement.
+repository such as `rev = "refs/pull/493/head"`.
+
+What references are available for the `rev` key varies by where the repo is hosted.
+GitHub exposes a reference to the most recent commit of every pull request as in the example above.
+Other git hosts may provide something equivalent under a different naming scheme.
+
+**More `git` dependency examples:**
+
+```toml
+# .git suffix can be omitted if the host accepts such URLs - both examples work the same
+regex = { git = "https://github.com/rust-lang/regex" }
+regex = { git = "https://github.com/rust-lang/regex.git" }
+
+# a commit with a particular tag
+regex = { git = "https://github.com/rust-lang/regex.git", tag = "1.10.3" }
+
+# a commit by its SHA1 hash
+regex = { git = "https://github.com/rust-lang/regex.git", rev = "0c0990399270277832fbb5b91a1fa118e6f63dba" }
+
+# HEAD commit of PR 493
+regex = { git = "https://github.com/rust-lang/regex.git", rev = "refs/pull/493/head" }
+
+# INVALID EXAMPLES
+
+# specifying the commit after # ignores the commit ID and generates a warning
+regex = { git = "https://github.com/rust-lang/regex.git#4c59b70" }
+
+# git and path cannot be used at the same time
+regex = { git = "https://github.com/rust-lang/regex.git#4c59b70", path = "../regex" }
+```
+
+Cargo locks the commits of `git` dependencies in `Cargo.lock` file at the time of their addition
+and checks for updates only when you run `cargo update` command.
+
+### The role of the `version` key
+
+The `version` key always implies that the package is available in a registry,
+regardless of the presence of `git` or `path` keys.
+
+The `version` key does _not_ affect which commit is used when Cargo retrieves the `git` dependency,
+but Cargo checks the version information in the dependency's `Cargo.toml` file
+against the `version` key and raises an error if the check fails.
+
+In this example, Cargo retrieves the HEAD commit of the branch called `next` from Git and checks if the crate's version
+is compatible with `version = "1.10.3"`:
+
+```toml
+[dependencies]
+regex = { version = "1.10.3", git = "https://github.com/rust-lang/regex.git", branch = "next" }
+```
+
+`version`, `git`, and `path` keys are considered separate locations for resolving the dependency.
+See [Multiple locations](#multiple-locations) section below for detailed explanations.
> **Note**: [crates.io] does not allow packages to be published with
> dependencies on code published outside of [crates.io] itself
@@ -229,7 +274,9 @@ See [Git Authentication] for help with git authentication for private repos.
> locations](#multiple-locations) section for a fallback alternative for `git`
> and `path` dependencies.
-[Git Authentication]: ../appendix/git-authentication.md
+### Accessing private Git repositories
+
+See [Git Authentication](../appendix/git-authentication.md) for help with Git authentication for private repos.
## Specifying path dependencies
@@ -237,7 +284,7 @@ Over time, our `hello_world` package from [the guide](../guide/index.md) has
grown significantly in size! It’s gotten to the point that we probably want to
split out a separate crate for others to use. To do this Cargo supports **path
dependencies** which are typically sub-crates that live within one repository.
-Let’s start off by making a new crate inside of our `hello_world` package:
+Let’s start by making a new crate inside of our `hello_world` package:
```console
# inside of hello_world/
@@ -245,7 +292,7 @@ $ cargo new hello_utils
```
This will create a new folder `hello_utils` inside of which a `Cargo.toml` and
-`src` folder are ready to be configured. In order to tell Cargo about this, open
+`src` folder are ready to be configured. To tell Cargo about this, open
up `hello_world/Cargo.toml` and add `hello_utils` to your dependencies:
```toml
@@ -254,30 +301,50 @@ hello_utils = { path = "hello_utils" }
```
This tells Cargo that we depend on a crate called `hello_utils` which is found
-in the `hello_utils` folder (relative to the `Cargo.toml` it’s written in).
+in the `hello_utils` folder, relative to the `Cargo.toml` file it’s written in.
+
+The next `cargo build` will automatically build `hello_utils` and
+all of its dependencies.
-And that’s it! The next `cargo build` will automatically build `hello_utils` and
-all of its own dependencies, and others can also start using the crate as well.
-However, crates that use dependencies specified with only a path are not
-permitted on [crates.io]. If we wanted to publish our `hello_world` crate, we
-would need to publish a version of `hello_utils` to [crates.io]
-and specify its version in the dependencies line as well:
+### No local path traversal
+
+The local paths must point to the exact folder with the dependency's `Cargo.toml`.
+Unlike with `git` dependencies, Cargo does not traverse local paths.
+For example, if `regex-lite` and `regex-syntax` are members of a
+locally cloned `rust-lang/regex` repo, they have to be referred to by the full path:
+
+```toml
+# git key accepts the repo root URL and Cargo traverses the tree to find the crate
+[dependencies]
+regex-lite = { git = "https://github.com/rust-lang/regex.git" }
+regex-syntax = { git = "https://github.com/rust-lang/regex.git" }
+
+# path key requires the member name to be included in the local path
+[dependencies]
+regex-lite = { path = "../regex/regex-lite" }
+regex-syntax = { path = "../regex/regex-syntax" }
+```
+
+### Local paths in published crates
+
+Crates that use dependencies specified with only a path are not
+permitted on [crates.io].
+
+If we wanted to publish our `hello_world` crate,
+we would need to publish a version of `hello_utils` to [crates.io] as a separate crate
+and specify its version in the dependencies line of `hello_world`:
```toml
[dependencies]
hello_utils = { path = "hello_utils", version = "0.1.0" }
```
-> **Note**: Neither the `git` key nor the `path` key changes the meaning of the
-> `version` key: the `version` key always implies that the package is available
-> in a registry. `version`, `git`, and `path` keys are considered [separate
-> locations](#multiple-locations) for resolving the dependency.
+The use of `path` and `version` keys together is explained in the [Multiple locations](#multiple-locations) section.
> **Note**: [crates.io] does not allow packages to be published with
-> dependencies on code published outside of [crates.io] itself
-> ([dev-dependencies] are ignored). See the [Multiple
-> locations](#multiple-locations) section for a fallback alternative for `git`
-> and `path` dependencies.
+> dependencies on code outside of [crates.io], except for [dev-dependencies].
+> See the [Multiple locations](#multiple-locations) section
+> for a fallback alternative for `git` and `path` dependencies.
## Multiple locations
diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1
index e7b728a6771..fc585fba6f5 100644
--- a/src/etc/man/cargo-add.1
+++ b/src/etc/man/cargo-add.1
@@ -123,7 +123,7 @@ Mark the dependency as \fIrequired\fR \fR
\fIenvironment variable\fR
is set when the integration test is built so that it can use the
@@ -166,11 +166,11 @@ is set when the integration test is built so that it can use the
executable.
.sp
Passing target selection flags will benchmark only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 4194d7b77d3..ba6ab38cd46 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -27,7 +27,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Build only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
@@ -57,7 +57,7 @@ they have \fBrequired\-features\fR that are missing.
.sp
Binary targets are automatically built if there is an integration test or
benchmark being selected to build. This allows an integration
-test to execute the binary to exercise and test its behavior.
+test to execute the binary to exercise and test its behavior.
The \fBCARGO_BIN_EXE_\fR
\fIenvironment variable\fR
is set when the integration test is built so that it can use the
@@ -65,11 +65,11 @@ is set when the integration test is built so that it can use the
executable.
.sp
Passing target selection flags will build only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index 43d570058f8..733b4b2fe7d 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -32,7 +32,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Check only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
@@ -61,11 +61,11 @@ binary and library targets of the selected packages. Binaries are skipped if
they have \fBrequired\-features\fR that are missing.
.sp
Passing target selection flags will check only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 69f781de6ae..5a61c0f3de3 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -47,7 +47,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Document only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index 1f10f179be5..27599a1fad1 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -127,7 +127,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Fix only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
@@ -156,11 +156,11 @@ When no target selection options are given, \fBcargo fix\fR will fix all targets
\fBrequired\-features\fR that are missing.
.sp
Passing target selection flags will fix only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1
index 1914ad5b33d..44de0a8053a 100644
--- a/src/etc/man/cargo-install.1
+++ b/src/etc/man/cargo-install.1
@@ -104,8 +104,8 @@ available.
.SS "Configuration Discovery"
This command operates on system or user level, not project level.
This means that the local \fIconfiguration discovery\fR is ignored.
-Instead, the configuration discovery begins at \fB$CARGO_HOME/config.toml\fR\&.
-If the package is installed with \fB\-\-path $PATH\fR, the local configuration
+Instead, the configuration discovery begins at \fB$CARGO_HOME/config.toml\fR\&.
+If the package is installed with \fB\-\-path $PATH\fR, the local configuration
will be used, beginning discovery at \fB$PATH/.cargo/config.toml\fR\&.
.SH "OPTIONS"
.SS "Install Options"
@@ -254,7 +254,7 @@ Directory for all generated artifacts and intermediate files. May also be
specified with the \fBCARGO_TARGET_DIR\fR environment variable, or the
\fBbuild.target\-dir\fR \fIconfig value\fR \&.
Defaults to a new temporary folder located in the
-temporary directory of the platform.
+temporary directory of the platform.
.sp
When using \fB\-\-path\fR, by default it will use \fBtarget\fR directory in the workspace
of the local crate unless \fB\-\-target\-dir\fR
diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1
index fa85c5a9c89..fe27b140075 100644
--- a/src/etc/man/cargo-metadata.1
+++ b/src/etc/man/cargo-metadata.1
@@ -357,7 +357,7 @@ possible value.
\fB\-\-filter\-platform\fR \fItriple\fR
.RS 4
This filters the \fBresolve\fR output to only include dependencies for the
-given \fItarget triple\fR \&.
+given \fItarget triple\fR \&.
Without this flag, the resolve includes all targets.
.sp
Note that the dependencies listed in the \[lq]packages\[rq] array still includes all
diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1
index f845cbc04ff..f565ad7d425 100644
--- a/src/etc/man/cargo-package.1
+++ b/src/etc/man/cargo-package.1
@@ -124,7 +124,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Package only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1
index b2d95b9fd87..d16cc4a4173 100644
--- a/src/etc/man/cargo-publish.1
+++ b/src/etc/man/cargo-publish.1
@@ -28,7 +28,7 @@ which registries you are allowed to publish to.
.sp
.RS 4
\h'-04' 3.\h'+01'Upload the crate to the registry. The server will perform additional
-checks on the crate.
+checks on the crate.
.RE
.sp
.RS 4
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index 2ecbbcf6529..29bfae8b8f5 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -14,8 +14,8 @@ All the arguments following the two dashes (\fB\-\-\fR) are passed to the binary
run. If you\[cq]re passing arguments to both Cargo and the binary, the ones after
\fB\-\-\fR go to the binary, the ones before go to Cargo.
.sp
-Unlike \fBcargo\-test\fR(1) and \fBcargo\-bench\fR(1), \fBcargo run\fR sets the
-working directory of the binary executed to the current working directory, same
+Unlike \fBcargo\-test\fR(1) and \fBcargo\-bench\fR(1), \fBcargo run\fR sets the
+working directory of the binary executed to the current working directory, same
as if it was executed in the shell directly.
.SH "OPTIONS"
.SS "Package Selection"
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index f3535b0f0c1..1fc7d74b04f 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -43,7 +43,7 @@ binary and library targets of the selected package.
.sp
Binary targets are automatically built if there is an integration test or
benchmark being selected to build. This allows an integration
-test to execute the binary to exercise and test its behavior.
+test to execute the binary to exercise and test its behavior.
The \fBCARGO_BIN_EXE_\fR
\fIenvironment variable\fR
is set when the integration test is built so that it can use the
@@ -51,11 +51,11 @@ is set when the integration test is built so that it can use the
executable.
.sp
Passing target selection flags will build only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index 9dff7f12ab5..93773ae2fdb 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -53,11 +53,11 @@ if its name is the same as the lib target. Binaries are skipped if they have
\fBrequired\-features\fR that are missing.
.sp
Passing target selection flags will document only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index 46700014789..b4eb1172167 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -98,7 +98,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Test only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
@@ -172,7 +172,7 @@ for more information on per\-target settings.
.sp
Binary targets are automatically built if there is an integration test or
benchmark being selected to test. This allows an integration
-test to execute the binary to exercise and test its behavior.
+test to execute the binary to exercise and test its behavior.
The \fBCARGO_BIN_EXE_\fR
\fIenvironment variable\fR
is set when the integration test is built so that it can use the
@@ -180,11 +180,11 @@ is set when the integration test is built so that it can use the
executable.
.sp
Passing target selection flags will test only the specified
-targets.
+targets.
.sp
-Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
-support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
-shell accidentally expanding glob patterns before Cargo handles them, you must
+Note that \fB\-\-bin\fR, \fB\-\-example\fR, \fB\-\-test\fR and \fB\-\-bench\fR flags also
+support common Unix glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your
+shell accidentally expanding glob patterns before Cargo handles them, you must
use single quotes or double quotes around each glob pattern.
.sp
\fB\-\-lib\fR
diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1
index 2abad97320b..2fab70be971 100644
--- a/src/etc/man/cargo-tree.1
+++ b/src/etc/man/cargo-tree.1
@@ -167,7 +167,7 @@ The default is \fBnormal,build,dev\fR\&.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
-Filter dependencies matching the given \fItarget triple\fR \&.
+Filter dependencies matching the given \fItarget triple\fR \&.
The default is the host platform. Use the value \fBall\fR to include \fIall\fR targets.
.RE
.SS "Tree Formatting Options"
@@ -240,7 +240,7 @@ virtual workspace will include all workspace members (equivalent to passing
.RS 4
Display only the specified packages. See \fBcargo\-pkgid\fR(1) for the
SPEC format. This flag may be specified multiple times and supports common Unix
-glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
+glob patterns like \fB*\fR, \fB?\fR and \fB[]\fR\&. However, to avoid your shell accidentally
expanding glob patterns before Cargo handles them, you must use single quotes or
double quotes around each pattern.
.RE
diff --git a/tests/testsuite/cargo_add/invalid_manifest/stderr.term.svg b/tests/testsuite/cargo_add/invalid_manifest/stderr.term.svg
index 636a4075104..b3ca44189ba 100644
--- a/tests/testsuite/cargo_add/invalid_manifest/stderr.term.svg
+++ b/tests/testsuite/cargo_add/invalid_manifest/stderr.term.svg
@@ -19,19 +19,19 @@
- error: invalid string
+ error: invalid string
- expected `"`, `'`
+ expected `"`, `'`
- --> Cargo.toml:9:7
+ --> Cargo.toml:9:7
- |
+ |
- 9 | key = invalid-value
+ 9 | key = invalid-value
- | ^
+ | ^
- |
+ |
diff --git a/tests/testsuite/cargo_add/mod.rs b/tests/testsuite/cargo_add/mod.rs
index bf52f6e7f51..8800ac23c67 100644
--- a/tests/testsuite/cargo_add/mod.rs
+++ b/tests/testsuite/cargo_add/mod.rs
@@ -123,6 +123,10 @@ mod rust_version_ignore;
mod rust_version_incompatible;
mod rust_version_latest;
mod rust_version_older;
+mod rustc_ignore;
+mod rustc_incompatible;
+mod rustc_latest;
+mod rustc_older;
mod sorted_table_with_dotted_item;
mod target;
mod target_cfg;
diff --git a/tests/testsuite/cargo_add/rust_version_incompatible/stderr.term.svg b/tests/testsuite/cargo_add/rust_version_incompatible/stderr.term.svg
index 916d611ad03..8983eae2f2f 100644
--- a/tests/testsuite/cargo_add/rust_version_incompatible/stderr.term.svg
+++ b/tests/testsuite/cargo_add/rust_version_incompatible/stderr.term.svg
@@ -1,4 +1,4 @@
-