Skip to content

Commit

Permalink
Wrap an error context for determining the amount of parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Mar 2, 2022
1 parent 1988bc8 commit 4f706ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cargo/core/compiler/build_config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::core::compiler::CompileKind;
use crate::util::interning::InternedString;
use crate::util::{CargoResult, Config, RustfixDiagnosticServer};
use anyhow::bail;
use anyhow::{bail, Context as _};
use cargo_util::ProcessBuilder;
use serde::ser;
use std::cell::RefCell;
Expand Down Expand Up @@ -73,7 +73,9 @@ impl BuildConfig {
}
let jobs = match jobs.or(cfg.jobs) {
Some(j) => j,
None => available_parallelism()?.get() as u32,
None => available_parallelism()
.context("failed to determine the amount of parallelism available")?
.get() as u32,
};
if jobs == 0 {
anyhow::bail!("jobs may not be 0");
Expand Down

0 comments on commit 4f706ae

Please sign in to comment.