Skip to content

Commit c29c25b

Browse files
loloicciEh2406
authored andcommitted
test error message trying patch non-existing package with prerelease version
1 parent 7541cc7 commit c29c25b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/testsuite/patch.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,3 +2658,43 @@ failed to select a version for `qux` which could resolve this conflict"#,
26582658
)
26592659
.run();
26602660
}
2661+
2662+
#[cargo_test]
2663+
fn mismatched_version_with_prerelease() {
2664+
Package::new("prerelease-deps", "0.0.1").publish();
2665+
// A patch to a location that has an prerelease version
2666+
let p = project()
2667+
.file(
2668+
"Cargo.toml",
2669+
r#"
2670+
[package]
2671+
name = "foo"
2672+
version = "0.1.0"
2673+
2674+
[dependencies]
2675+
prerelease-deps = "0.1.0"
2676+
2677+
[patch.crates-io]
2678+
prerelease-deps = { path = "./prerelease-deps" }
2679+
"#,
2680+
)
2681+
.file("src/lib.rs", "")
2682+
.file(
2683+
"prerelease-deps/Cargo.toml",
2684+
&basic_manifest("prerelease-deps", "0.1.1-pre1"),
2685+
)
2686+
.file("prerelease-deps/src/lib.rs", "")
2687+
.build();
2688+
2689+
p.cargo("generate-lockfile")
2690+
.with_status(101)
2691+
.with_stderr(
2692+
r#"[UPDATING] `dummy-registry` index
2693+
[ERROR] failed to select a version for the requirement `prerelease-deps = "^0.1.0"`
2694+
candidate versions found which didn't match: 0.0.1
2695+
location searched: `dummy-registry` index (which is replacing registry `crates-io`)
2696+
required by package `foo v0.1.0 [..]`
2697+
perhaps a crate was updated and forgotten to be re-vendored?"#,
2698+
)
2699+
.run();
2700+
}

0 commit comments

Comments
 (0)