]> git.proxmox.com Git - cargo.git/commitdiff
Wrap an error context for determining the amount of parallelism
authorWeihang Lo <me@weihanglo.tw>
Wed, 2 Mar 2022 11:41:31 +0000 (19:41 +0800)
committerWeihang Lo <me@weihanglo.tw>
Wed, 2 Mar 2022 11:41:31 +0000 (19:41 +0800)
src/cargo/core/compiler/build_config.rs

index 54b2fd9b12cfd40fce6a27ef2a64e624bc79b5b8..31cd3e3da53cd6ab93d93013605f15cf2ec22ec9 100644 (file)
@@ -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;
@@ -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");