Skip to content

Commit 61206c4

Browse files
committed
Fix for for setting test-threads to 0
Running test with cargo test -- --test-threads=0 causes cargo to hang as 0 is a valid usize. Adding zero threads as a special case to the error handling.
1 parent bd16aa0 commit 61206c4

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
@@ -439,6 +439,8 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
439439
let test_threads = match matches.opt_str("test-threads") {
440440
Some(n_str) =>
441441
match n_str.parse::<usize>() {
442+
Ok(0) =>
443+
return Some(Err(format!("argument for --test-threads must not be 0"))),
442444
Ok(n) => Some(n),
443445
Err(e) =>
444446
return Some(Err(format!("argument for --test-threads must be a number > 0 \

0 commit comments

Comments
 (0)