// settings like debuginfo and whatnot.
unit.profile.hash(&mut hasher);
unit.mode.hash(&mut hasher);
+ if let Some(ref args) = cx.extra_args_for(unit) {
+ args.hash(&mut hasher);
+ }
// Artifacts compiled for the host should have a different metadata
// piece than those compiled for the target, so make sure we throw in
/// rustc` and `cargo rustdoc`. These commands only support one target,
/// but we don't want the args passed to any dependencies, so we include
/// the `Unit` corresponding to the top-level target.
- pub extra_compiler_args: Option<(Unit<'a>, Vec<String>)>,
+ extra_compiler_args: Option<(Unit<'a>, Vec<String>)>,
target_info: TargetInfo,
host_info: TargetInfo,
Kind::Target => &self.target_info,
}
}
+
+ pub fn extra_args_for(&self, unit: &Unit<'a>) -> Option<&Vec<String>> {
+ if let Some((ref args_unit, ref args)) = self.extra_compiler_args {
+ if args_unit == unit {
+ return Some(args);
+ }
+ }
+ None
+ }
}
/// Acquire extra flags to pass to the compiler from various locations.
}
}
- let allow_failure = cx.extra_compiler_args.is_some();
+ let allow_failure = cx.extra_args_for(unit).is_some();
let target_root = cx.files().target_root().to_path_buf();
let write_fingerprint = Work::new(move |_| {
match fingerprint.update_local(&target_root) {
} else {
cx.rustflags_args(unit)?
};
+ let profile_hash = util::hash_u64(&(
+ &unit.profile,
+ unit.mode,
+ cx.extra_args_for(unit),
+ cx.incremental_args(unit)?,
+ ));
let fingerprint = Arc::new(Fingerprint {
rustc: util::hash_u64(&cx.build_config.rustc.verbose_version),
target: util::hash_u64(&unit.target),
- profile: util::hash_u64(&(&unit.profile, unit.mode, cx.incremental_args(unit)?)),
+ profile: profile_hash,
// Note that .0 is hashed here, not .1 which is the cwd. That doesn't
// actually affect the output artifact so there's no need to hash it.
path: util::hash_u64(&super::path_args(cx, unit).0),
rustdoc.arg(format!("--edition={}", &manifest.edition()));
}
- if let Some((ref args_unit, ref args)) = cx.extra_compiler_args {
- if args_unit == unit {
- rustdoc.args(args);
- }
+ if let Some(ref args) = cx.extra_args_for(unit) {
+ rustdoc.args(args);
}
build_deps_args(&mut rustdoc, cx, unit)?;
cmd.arg("-C").arg(format!("debuginfo={}", debuginfo));
}
- if let Some((ref args_unit, ref args)) = cx.extra_compiler_args {
- if args_unit == unit {
- cmd.args(args);
- }
+ if let Some(ref args) = cx.extra_args_for(unit) {
+ cmd.args(args);
}
// -C overflow-checks is implied by the setting of -C debug-assertions,