Skip to content

Commit 675d67d

Browse files
committed
fix(msrv): Error, rather than panic, on rust-version 'x'
Fixes #13768
1 parent af9288f commit 675d67d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

crates/cargo-util-schemas/src/core/partial_version.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,9 @@ fn is_req(value: &str) -> bool {
183183
let Some(first) = value.chars().next() else {
184184
return false;
185185
};
186-
"<>=^~".contains(first) || value.contains('*') || value.contains(',')
186+
"<>=^~".contains(first)
187+
|| value.contains('*')
188+
|| value.contains(',')
189+
|| value.contains('x')
190+
|| value.contains('X')
187191
}

tests/testsuite/rust_version.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ fn rust_version_bad_pre_release() {
125125
}
126126

127127
#[cargo_test]
128-
#[should_panic]
129128
fn rust_version_x_wildcard() {
130129
project()
131130
.file(
@@ -150,16 +149,15 @@ fn rust_version_x_wildcard() {
150149
[ERROR] unexpected version requirement, expected a version like \"1.32\"
151150
--> Cargo.toml:7:28
152151
|
153-
7 | rust-version = \"^1.43\"
154-
| ^^^^^^^
152+
7 | rust-version = \"x\"
153+
| ^^^
155154
|
156155
",
157156
)
158157
.run();
159158
}
160159

161160
#[cargo_test]
162-
#[should_panic]
163161
fn rust_version_minor_x_wildcard() {
164162
project()
165163
.file(
@@ -193,7 +191,6 @@ fn rust_version_minor_x_wildcard() {
193191
}
194192

195193
#[cargo_test]
196-
#[should_panic]
197194
fn rust_version_patch_x_wildcard() {
198195
project()
199196
.file(

0 commit comments

Comments
 (0)