Skip to content

Commit

Permalink
don't write a an incorrect rustc version to the fingerprint file
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Dec 21, 2018
1 parent 1dff476 commit eb8720a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ pub fn prepare_build_cmd<'a, 'cfg>(
debug!("fingerprint at: {}", loc.display());

let (local, output_path) = build_script_local_fingerprints(cx, unit)?;
let mut fingerprint = Fingerprint { local, ..Fingerprint::new() };
let mut fingerprint = Fingerprint {
local,
rustc: util::hash_u64(&cx.bcx.rustc.verbose_version),
..Fingerprint::new()
};
let compare = compare_old_fingerprint(&loc, &fingerprint);
log_compare(unit, &compare);

Expand Down Expand Up @@ -648,6 +652,10 @@ fn local_fingerprints_deps(
}

fn write_fingerprint(loc: &Path, fingerprint: &Fingerprint) -> CargoResult<()> {
debug_assert_ne!(fingerprint.rustc, 0);
// fingerprint::new().rustc == 0, make sure it doesn't make it to the file system.
// This is mostly so outside tools can reliably find out what rust version this file is for,
// as we can use the full hash.
let hash = fingerprint.hash();
debug!("write fingerprint: {}", loc.display());
paths::write(loc, util::to_hex(hash).as_bytes())?;
Expand Down

0 comments on commit eb8720a

Please sign in to comment.