X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fbootstrap%2Fconfig.rs;h=66f504ea924e9b880b525ea47409d29db868286e;hb=adea1317c24738563a507b817bbf9c57471279f0;hp=d618654b129af844b3a3a1ca6097da7ae6e39d3d;hpb=dd33e8a84a2933a11d89dc78c164b639b842fc43;p=rust.git diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index d618654b129..66f504ea924 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -11,7 +11,6 @@ use std::cmp; use build_helper::t; -use num_cpus; use toml; use serde::Deserialize; use crate::cache::{INTERNER, Interned}; @@ -52,7 +51,7 @@ pub struct Config { pub test_compare_mode: bool, pub llvm_libunwind: bool, - pub run_host_only: bool, + pub skip_only_host_steps: bool, pub on_fail: Option, pub stage: Option, @@ -401,7 +400,7 @@ pub fn parse(args: &[String]) -> Config { config.rustc_error_format = flags.rustc_error_format; config.on_fail = flags.on_fail; config.stage = flags.stage; - config.jobs = flags.jobs; + config.jobs = flags.jobs.map(threads_from_config); config.cmd = flags.cmd; config.incremental = flags.incremental; config.dry_run = flags.dry_run; @@ -417,7 +416,9 @@ pub fn parse(args: &[String]) -> Config { } // If --target was specified but --host wasn't specified, don't run any host-only tests. - config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty()); + let has_hosts = !flags.host.is_empty(); + let has_targets = !flags.target.is_empty(); + config.skip_only_host_steps = !has_hosts && has_targets; let toml = file.map(|file| { let contents = t!(fs::read_to_string(&file)); @@ -583,13 +584,8 @@ pub fn parse(args: &[String]) -> Config { set(&mut config.rust_codegen_backends_dir, rust.codegen_backends_dir.clone()); - match rust.codegen_units { - Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32), - Some(n) => config.rust_codegen_units = Some(n), - None => {} - } - - config.rust_codegen_units_std = rust.codegen_units_std; + config.rust_codegen_units = rust.codegen_units.map(threads_from_config); + config.rust_codegen_units_std = rust.codegen_units_std.map(threads_from_config); } if let Some(ref t) = toml.target { @@ -688,3 +684,10 @@ fn set(field: &mut T, val: Option) { *field = v; } } + +fn threads_from_config(v: u32) -> u32 { + match v { + 0 => num_cpus::get() as u32, + n => n, + } +}