提交 912bc14a 编写于 作者: B bors

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.
......@@ -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 \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册