Skip to content

Commit

Permalink
fix(msrv): Error, rather than panic, on rust-version 'x'
Browse files Browse the repository at this point in the history
Fixes #13768
  • Loading branch information
epage committed Apr 17, 2024
1 parent af9288f commit 675d67d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 5 additions & 1 deletion crates/cargo-util-schemas/src/core/partial_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,9 @@ fn is_req(value: &str) -> bool {
let Some(first) = value.chars().next() else {
return false;
};
"<>=^~".contains(first) || value.contains('*') || value.contains(',')
"<>=^~".contains(first)
|| value.contains('*')
|| value.contains(',')
|| value.contains('x')
|| value.contains('X')
}
7 changes: 2 additions & 5 deletions tests/testsuite/rust_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ fn rust_version_bad_pre_release() {
}

#[cargo_test]
#[should_panic]
fn rust_version_x_wildcard() {
project()
.file(
Expand All @@ -150,16 +149,15 @@ fn rust_version_x_wildcard() {
[ERROR] unexpected version requirement, expected a version like \"1.32\"
--> Cargo.toml:7:28
|
7 | rust-version = \"^1.43\"
| ^^^^^^^
7 | rust-version = \"x\"
| ^^^
|
",
)
.run();
}

#[cargo_test]
#[should_panic]
fn rust_version_minor_x_wildcard() {
project()
.file(
Expand Down Expand Up @@ -193,7 +191,6 @@ fn rust_version_minor_x_wildcard() {
}

#[cargo_test]
#[should_panic]
fn rust_version_patch_x_wildcard() {
project()
.file(
Expand Down

0 comments on commit 675d67d

Please sign in to comment.