Skip to content

Commit eb8720a

Browse files
committed
don't write a an incorrect rustc version to the fingerprint file
1 parent 1dff476 commit eb8720a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/cargo/core/compiler/fingerprint.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,11 @@ pub fn prepare_build_cmd<'a, 'cfg>(
545545
debug!("fingerprint at: {}", loc.display());
546546

547547
let (local, output_path) = build_script_local_fingerprints(cx, unit)?;
548-
let mut fingerprint = Fingerprint { local, ..Fingerprint::new() };
548+
let mut fingerprint = Fingerprint {
549+
local,
550+
rustc: util::hash_u64(&cx.bcx.rustc.verbose_version),
551+
..Fingerprint::new()
552+
};
549553
let compare = compare_old_fingerprint(&loc, &fingerprint);
550554
log_compare(unit, &compare);
551555

@@ -648,6 +652,10 @@ fn local_fingerprints_deps(
648652
}
649653

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

0 commit comments

Comments
 (0)