Skip to content

Commit

Permalink
refactor(resolve): Abstract out MSRV policy tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Apr 11, 2024
1 parent 789eda2 commit 11448b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ impl<'gctx> Workspace<'gctx> {
self.members().filter_map(|pkg| pkg.rust_version()).min()
}

pub fn resolve_honors_rust_version(&self) -> bool {
self.gctx().cli_unstable().msrv_policy
}

pub fn custom_metadata(&self) -> Option<&toml::Value> {
self.custom_metadata.as_ref()
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ pub fn resolve_with_previous<'gctx>(
if ws.gctx().cli_unstable().minimal_versions {
version_prefs.version_ordering(VersionOrdering::MinimumVersionsFirst)
}
if ws.gctx().cli_unstable().msrv_policy {
if ws.resolve_honors_rust_version() {
version_prefs.max_rust_version(ws.rust_version().cloned().map(RustVersion::into_partial));
}

Expand Down

0 comments on commit 11448b4

Please sign in to comment.