Skip to content

Commit 3c411d1

Browse files
committed
ctest: Add generation, compilation, and running of tests for constants.
1 parent f84df49 commit 3c411d1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ctest-next/src/rustc_queries.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@ pub fn rustc_version() -> Result<RustcVersion> {
4242
return Err(error.into());
4343
}
4444

45-
// eg: rustc 1.87.0 (17067e9ac 2025-05-09)
45+
// eg: rustc 1.87.0-(optionally nightly) (17067e9ac 2025-05-09)
4646
// Assume the format does not change.
4747
let [major, minor, patch] = std::str::from_utf8(&output.stdout)?
4848
.split_whitespace()
4949
.nth(1)
5050
.unwrap()
5151
.split('.')
5252
.take(3)
53-
.map(|s| s.parse::<u8>())
53+
.map(|s| {
54+
s.chars()
55+
.take_while(|c| c.is_ascii_digit())
56+
.collect::<String>()
57+
.trim()
58+
.parse::<u8>()
59+
})
5460
.collect::<Result<Vec<u8>, ParseIntError>>()?
5561
.try_into()
5662
.unwrap();
@@ -72,7 +78,7 @@ pub fn rustc_host() -> Result<String> {
7278
return Err(error.into());
7379
}
7480

75-
// eg: rustc 1.87.0 (17067e9ac 2025-05-09)
81+
// eg: rustc 1.87.0-(optionally nightly) (17067e9ac 2025-05-09)
7682
// binary: rustc
7783
// commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
7884
// commit-date: 2025-05-09

0 commit comments

Comments
 (0)