Skip to content

Commit 1cbf2b0

Browse files
committed
fix(resolver); Prefer rust-version over schema version
1 parent bde8332 commit 1cbf2b0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/cargo/core/resolver/errors.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,23 @@ pub(super) fn activation_error(
362362
let _ = writeln!(&mut msg, " version {} is not cached", summary.version());
363363
}
364364
IndexSummary::Unsupported(summary, schema_version) => {
365-
let _ = writeln!(
365+
if let Some(rust_version) = summary.rust_version() {
366+
// HACK: technically its unsupported and we shouldn't make assumptions
367+
// about the entry but this is limited and for diagnostics purposes
368+
let _ = writeln!(
369+
&mut msg,
370+
" version {} requires cargo {}",
371+
summary.version(),
372+
rust_version
373+
);
374+
} else {
375+
let _ = writeln!(
366376
&mut msg,
367377
" version {} requires a Cargo version that supports index version {}",
368378
summary.version(),
369379
schema_version
370380
);
381+
}
371382
}
372383
}
373384
}

tests/testsuite/registry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3267,7 +3267,7 @@ fn unknown_index_version_with_msrv_error() {
32673267
.with_stderr_data(str![[r#"
32683268
[UPDATING] `dummy-registry` index
32693269
[ERROR] no matching versions for `bar` found
3270-
version 1.0.1 requires a Cargo version that supports index version 4294967295
3270+
version 1.0.1 requires cargo 1.2345
32713271
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
32723272
required by package `foo v0.1.0 ([ROOT]/foo)`
32733273

0 commit comments

Comments
 (0)