Skip to content

Commit

Permalink
fix(resolver): Prefer rust-version over schema version
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Dec 5, 2024
1 parent e8228c2 commit 7627738
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/cargo/core/resolver/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,23 @@ pub(super) fn activation_error(
let _ = writeln!(&mut msg, " version {} is not cached", summary.version());
}
IndexSummary::Unsupported(summary, schema_version) => {
let _ = writeln!(
if let Some(rust_version) = summary.rust_version() {
// HACK: technically its unsupported and we shouldn't make assumptions
// about the entry but this is limited and for diagnostics purposes
let _ = writeln!(
&mut msg,
" version {} requires cargo {}",
summary.version(),
rust_version
);
} else {
let _ = writeln!(
&mut msg,
" version {} requires a Cargo version that supports index version {}",
summary.version(),
schema_version
);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3267,7 +3267,7 @@ fn unknown_index_version_with_msrv_error() {
.with_stderr_data(str![[r#"
[UPDATING] `dummy-registry` index
[ERROR] no matching versions for `bar` found
version 1.0.1 requires a Cargo version that supports index version 4294967295
version 1.0.1 requires cargo 1.2345
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
required by package `foo v0.1.0 ([ROOT]/foo)`
Expand Down

0 comments on commit 7627738

Please sign in to comment.