This means we can store the cache file name in one place.
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use util::{CargoResult, CargoResultExt, Config, Rustc};
+use core::Workspace;
use super::BuildOutput;
/// Configuration information for a rustc build.
config: &Config,
jobs: Option<u32>,
requested_target: &Option<String>,
- rustc_info_cache: Option<PathBuf>,
+ ws: Option<&Workspace>,
mode: CompileMode,
) -> CargoResult<BuildConfig> {
let requested_target = match requested_target {
None => None,
};
let jobs = jobs.or(cfg_jobs).unwrap_or(::num_cpus::get() as u32);
- let rustc = config.rustc(rustc_info_cache)?;
+ let rustc = config.rustc(ws)?;
let host_config = TargetConfig::new(config, &rustc.host)?;
let target_config = match target.as_ref() {
Some(triple) => TargetConfig::new(config, triple)?,
ref export_dir,
} = *options;
- let rustc_info_cache = ws.target_dir()
- .join(".rustc_info.json")
- .into_path_unlocked();
- let mut build_config = BuildConfig::new(config, jobs, &target, Some(rustc_info_cache), mode)?;
+ let mut build_config = BuildConfig::new(config, jobs, &target, Some(ws), mode)?;
build_config.release = release;
build_config.message_format = message_format;
let default_arch_kind = if build_config.requested_target.is_some() {
use lazycell::LazyCell;
use core::shell::Verbosity;
-use core::{CliUnstable, Shell, SourceId};
+use core::{CliUnstable, Shell, SourceId, Workspace};
use ops;
use url::Url;
use util::ToUrl;
}
/// Get the path to the `rustc` executable
- pub fn rustc(&self, cache_location: Option<PathBuf>) -> CargoResult<Rustc> {
+ pub fn rustc(&self, ws: Option<&Workspace>) -> CargoResult<Rustc> {
+ let cache_location = ws.map(|ws| {
+ ws.target_dir()
+ .join(".rustc_info.json")
+ .into_path_unlocked()
+ });
Rustc::new(
self.get_tool("rustc")?,
self.maybe_get_tool("rustc_wrapper")?,