fix(resolver): Prefer rust-version over schema version

This commit is contained in:
Ed Page 2024-12-05 11:35:10 -06:00
parent 06b5ec5765
commit 0ed5c215a2
2 changed files with 13 additions and 2 deletions

View File

@ -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
);
}
}
}
}

View File

@ -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)`