Skip to content

Commit 912bc14

Browse files
committed
Auto merge of #38945 - battisti:fix_thread_num, r=alexcrichton
treat setting the number of test-threads to 0 as an error It is currently possible to call `cargo test -- --test-threads=0` which will cause cargo to hang until aborted. This change will fix that and will report an appropriate error to the user.
2 parents ba7cf7c + 0a4c268 commit 912bc14

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libtest/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
445445
let test_threads = match matches.opt_str("test-threads") {
446446
Some(n_str) =>
447447
match n_str.parse::<usize>() {
448+
Ok(0) =>
449+
return Some(Err(format!("argument for --test-threads must not be 0"))),
448450
Ok(n) => Some(n),
449451
Err(e) =>
450452
return Some(Err(format!("argument for --test-threads must be a number > 0 \

0 commit comments

Comments
 (0)