Skip to content

Commit 32bf8d2

Browse files
committed
docs(ref): Document MSRV-aware resolver
1 parent eb45071 commit 32bf8d2

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 thes
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
@@ -343,31 +343,7 @@ This was stabilized in 1.79 in [#13608](https://github.com/rust-lang/cargo/pull/
343343

344344
### MSRV-aware resolver
345345

346-
`-Zmsrv-policy` allows access to an MSRV-aware resolver which can be enabled with:
347-
- `resolver.incompatible-rust-versions` config field
348-
- `workspace.resolver = "3"` / `package.resolver = "3"`
349-
- `package.edition = "2024"` (only in workspace root)
350-
351-
The resolver will prefer dependencies with a `package.rust-version` that is the same or older than your project's MSRV.
352-
As the resolver is unable to determine which workspace members will eventually
353-
depend on a package when it is being selected, we prioritize versions based on
354-
how many workspace member MSRVs they are compatible with.
355-
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`).
356-
357-
#### `resolver.incompatible-rust-versions`
358-
* Type: string
359-
* Default: `"allow"`
360-
* Environment: `CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS`
361-
362-
When resolving a version for a dependency, select how versions with incompatible `package.rust-version`s are treated.
363-
Values include:
364-
- `allow`: treat `rust-version`-incompatible versions like any other version
365-
- `fallback`: only consider `rust-version`-incompatible versions if no other version matched
366-
367-
Can be overridden with
368-
- `--ignore-rust-version` CLI option
369-
- Setting the dependency's version requirement higher than any version with a compatible `rust-version`
370-
- Specifying the version to `cargo update` with `--precise`
346+
This was stabilized in 1.83 in #.
371347

372348
### Convert `incompatible_toolchain` error into a lint
373349

0 commit comments

Comments
 (0)