You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/doc/src/reference/rust-version.md
+20-8Lines changed: 20 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,7 @@
1
1
# Rust Version
2
2
3
3
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.
12
5
13
6
```toml
14
7
[package]
@@ -25,3 +18,22 @@ To find the minimum `rust-version` compatible with your project, you can use thi
25
18
When used on packages that get published, we recommend [verifying the `rust-version`](../guide/continuous-integration.md#verifying-rust-version).
26
19
27
20
> **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
0 commit comments