Skip to content

Commit 15f149e

Browse files
committed
docs(ref): Document MSRV-aware resolver
1 parent 7975913 commit 15f149e

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

src/doc/src/reference/config.md

+25
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ rpath = false # Sets the rpath linking option.
143143
[profile.<name>.package.<name>] # Override profile for a package.
144144
# Same keys for a normal profile (minus `panic`, `lto`, and `rpath`).
145145

146+
[resolver]
147+
incompatible-rust-versions = "allow" # Specifies how resolver reacts to these
148+
146149
[registries.<name>] # registries other than crates.io
147150
index = "" # URL of the registry index
148151
token = "" # authentication token for the registry
@@ -972,6 +975,28 @@ See [rpath](profiles.md#rpath).
972975

973976
See [strip](profiles.md#strip).
974977

978+
### `[resolver]`
979+
980+
The `[resolver]` table overrides [dependency resolution behavior](resolver.md) for local development (e.g. excludes `cargo install`).
981+
982+
#### `resolver.incompatible-rust-versions`
983+
* Type: string
984+
* Default: `"allow"`
985+
* Environment: `CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS`
986+
987+
When resolving which version of a dependency to use, select how versions with incompatible `package.rust-version`s are treated.
988+
Values include:
989+
- `allow`: treat `rust-version`-incompatible versions like any other version
990+
- `fallback`: only consider `rust-version`-incompatible versions if no other version matched
991+
992+
Can be overridden with
993+
- `--ignore-rust-version` CLI option
994+
- Setting the dependency's version requirement higher than any version with a compatible `rust-version`
995+
- Specifying the version to `cargo update` with `--precise`
996+
997+
> **MSRV:**
998+
> - `allow` is supported on any version
999+
> - `fallback` is respected as of 1.83
9751000
9761001
### `[registries]`
9771002

src/doc/src/reference/unstable.md

+1-25
Original file line numberDiff line numberDiff line change
@@ -350,31 +350,7 @@ This was stabilized in 1.79 in [#13608](https://github.com/rust-lang/cargo/pull/
350350

351351
### MSRV-aware resolver
352352

353-
`-Zmsrv-policy` allows access to an MSRV-aware resolver which can be enabled with:
354-
- `resolver.incompatible-rust-versions` config field
355-
- `workspace.resolver = "3"` / `package.resolver = "3"`
356-
- `package.edition = "2024"` (only in workspace root)
357-
358-
The resolver will prefer dependencies with a `package.rust-version` that is the same or older than your project's MSRV.
359-
As the resolver is unable to determine which workspace members will eventually
360-
depend on a package when it is being selected, we prioritize versions based on
361-
how many workspace member MSRVs they are compatible with.
362-
If there is no MSRV set then your toolchain version will be used, allowing it to pick up the toolchain version from pinned in rustup (e.g. `rust-toolchain.toml`).
363-
364-
#### `resolver.incompatible-rust-versions`
365-
* Type: string
366-
* Default: `"allow"`
367-
* Environment: `CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS`
368-
369-
When resolving a version for a dependency, select how versions with incompatible `package.rust-version`s are treated.
370-
Values include:
371-
- `allow`: treat `rust-version`-incompatible versions like any other version
372-
- `fallback`: only consider `rust-version`-incompatible versions if no other version matched
373-
374-
Can be overridden with
375-
- `--ignore-rust-version` CLI option
376-
- Setting the dependency's version requirement higher than any version with a compatible `rust-version`
377-
- Specifying the version to `cargo update` with `--precise`
353+
This was stabilized in 1.83 in [#14639](https://github.com/rust-lang/cargo/pull/14639).
378354

379355
### Convert `incompatible_toolchain` error into a lint
380356

0 commit comments

Comments
 (0)