mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #6473 - Eh2406:rustc-0, r=alexcrichton
don't write a an incorrect rustc version to the fingerprint file In making https://github.com/holmgr/cargo-sweep/pull/14 I noted that some fingerprint files related to build scripts report being built with a rustc that hashes to "0". To work around this I just marked them as still being needed, even though no rustc that hashes to "0" is currently installed. I believe that this PR just filles in the correct info for the build script fingerprints. This makes it possible for outside tools to more reliably clean up after cargo, at basically no cost. @ehuss Thanks again for the help.
This commit is contained in:
commit
b61f3cc66b
@ -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);
|
||||
|
||||
@ -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())?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user