From af8eed964532b7bd2c511b68dd16e57cd7b8c2d2 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 5 Dec 2024 11:32:32 -0600 Subject: [PATCH] test(resolver): Show error with MSRV set --- tests/testsuite/registry.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/testsuite/registry.rs b/tests/testsuite/registry.rs index c8697dcc06c..56ca49dea3c 100644 --- a/tests/testsuite/registry.rs +++ b/tests/testsuite/registry.rs @@ -3238,6 +3238,43 @@ required by package `foo v0.1.0 ([ROOT]/foo)` .run(); } +#[cargo_test] +fn unknown_index_version_with_msrv_error() { + // If the version field is not understood, it is ignored. + Package::new("bar", "1.0.1") + .schema_version(u32::MAX) + .rust_version("1.2345") + .publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + edition = "2015" + + [dependencies] + bar = "1.0" + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("generate-lockfile") + .with_status(101) + .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 +location searched: `dummy-registry` index (which is replacing registry `crates-io`) +required by package `foo v0.1.0 ([ROOT]/foo)` + +"#]]) + .run(); +} + #[cargo_test] fn protocol() { cargo_process("install bar")