Skip to content

Commit 17ecc17

Browse files
committed
docs(ref): Expand on uses of Rust version
1 parent e38e966 commit 17ecc17

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/doc/src/reference/manifest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ will have `edition` explicitly specified to a newer value.
164164
### The `rust-version` field
165165

166166
The `rust-version` field tells cargo what version of the
167-
Rust language and compiler you support for your package.
167+
Rust toolchain you support for your package.
168168
See [the Rust version chapter](rust-version.md) for more detail.
169169

170170
### The `description` field

src/doc/src/reference/rust-version.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
# Rust Version
22

33
The `rust-version` field is an optional key that tells cargo what version of the
4-
Rust language and compiler you support for your package.
5-
If the currently selected version of the Rust compiler is older than the stated
6-
version, cargo will exit with an error, telling the user what version is
7-
required.
8-
This affects all targets/crates in the package, including test suites,
9-
benchmarks, binaries, examples, etc.
10-
11-
The `rust-version` may be ignored using the `--ignore-rust-version` option.
4+
Rust toolchain you support for your package.
125

136
```toml
147
[package]
@@ -25,3 +18,22 @@ To find the minimum `rust-version` compatible with your project, you can use thi
2518
When used on packages that get published, we recommend [verifying the `rust-version`](../guide/continuous-integration.md#verifying-rust-version).
2619

2720
> **MSRV:** Respected as of 1.56
21+
22+
## Uses
23+
24+
**Diagnostics:**
25+
26+
When your package is compiled on an unsupported toolchain,
27+
Cargo will provide clearer diagnostics about the insufficient toolchain version rather than reporting invalid syntax or missing functionality in the standard library.
28+
This affects all [Cargo targets](cargo-targets.md) in the package, including binaries, examples, test suites,
29+
benchmarks, etc.
30+
31+
**Development aid:**
32+
33+
`cargo add` will auto-select the dependency's version requirement to be the latest version compatible with your `rust-version`.
34+
If that isn't the latest version, `cargo add` will inform users so they can make the choice on whether to keep it or update your `rust-version`.
35+
36+
Other tools may also take advantage of it, like `cargo clippy`'s
37+
[`incompatible_msrv` lint](https://rust-lang.github.io/rust-clippy/stable/index.html#/incompatible_msrv).
38+
39+
> **Note:** The `rust-version` may be ignored using the `--ignore-rust-version` option.

0 commit comments

Comments
 (0)