Skip to content

Commit b2fd7e5

Browse files
authored
Merge pull request #328 from epage/msrv
docs(cargo): Cover MSRV-aware resolver
2 parents 1f07c24 + eb24f96 commit b2fd7e5

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
- [`unsafe_op_in_unsafe_fn` warning](rust-2024/unsafe-op-in-unsafe-fn.md)
4545
- [RPIT lifetime capture rules](rust-2024/rpit-lifetime-capture.md)
4646
- [Disallow references to `static mut`](rust-2024/static-mut-references.md)
47+
- [Cargo: Rust-version aware resolver](rust-2024/cargo-resolver.md)
4748
- [Cargo: Table and key name consistency](rust-2024/cargo-table-key-names.md)
4849
- [Cargo: Reject unused inherited default-features](rust-2024/cargo-inherited-default-features.md)
4950
- [Rustfmt: Combine all delimited exprs as last argument](rust-2024/rustfmt-overflow-delimited-expr.md)

src/rust-2024/cargo-resolver.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Cargo: Rust-version aware resolver
2+
3+
🚧 The 2024 Edition has not yet been released and hence this section is still "under construction".
4+
5+
## Summary
6+
7+
- `edition = "2024"` implies `resolver = "3"` in `Cargo.toml` which enables a Rust-version aware dependency resolver.
8+
9+
## Details
10+
11+
Since Rust 1.84.0, Cargo has opt-in support for compatibility with
12+
[`package.rust-version`] to be considered when selecting dependency versions
13+
by setting [`resolver.incompatible-rust-version = "fallback"`] in `.cargo/config.toml`.
14+
15+
Starting in Rust 2024, this will be the default.
16+
That is, writing `edition = "2024"` in `Cargo.toml` will imply `resolver = "3"`
17+
which will imply [`resolver.incompatible-rust-version = "fallback"`].
18+
19+
The resolver is a global setting for a [workspace], and the setting is ignored in dependencies.
20+
The setting is only honored for the top-level package of the workspace.
21+
If you are using a [virtual workspace], you will still need to explicitly set the [`resolver` field]
22+
in the `[workspace]` definition if you want to opt-in to the new resolver.
23+
24+
For more details on how Rust-version aware dependency resolution works, see [the Cargo book](../..//cargo/reference/resolver.html#rust-version).
25+
26+
[`package.rust-version`]: ../../cargo/reference/rust-version.html
27+
[`resolver.incompatible-rust-version = "fallback"`]: ../../cargo/reference/config.html#resolverincompatible-rust-versions
28+
[workspace]: ../../cargo/reference/workspaces.html
29+
[virtual workspace]: ../../cargo/reference/workspaces.html#virtual-workspace
30+
[`resolver` field]: ../../cargo/reference/resolver.html#resolver-versions
31+
32+
## Migration
33+
34+
There are no automated migration tools for updating for the new resolver.
35+
36+
We recommend projects
37+
[verify against the latest dependencies in CI](../../cargo/guide/continuous-integration.html#verifying-latest-dependencies)
38+
to catch bugs in dependencies as soon as possible.

0 commit comments

Comments
 (0)