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.
This commit is contained in:
bors 2017-02-12 00:54:57 +00:00
commit 912bc14a6b

View File

@ -445,6 +445,8 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
let test_threads = match matches.opt_str("test-threads") {
Some(n_str) =>
match n_str.parse::<usize>() {
Ok(0) =>
return Some(Err(format!("argument for --test-threads must not be 0"))),
Ok(n) => Some(n),
Err(e) =>
return Some(Err(format!("argument for --test-threads must be a number > 0 \