Skip to content

Commit 674e609

Browse files
committed
refactor: make room for adapting rustc-stable-hasher
1 parent c2b0d50 commit 674e609

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/cargo/core/compiler/build_runner/compilation_files.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,8 @@ fn compute_metadata(
718718
}
719719
}
720720

721-
let c_metadata = UnitHash(c_metadata_hasher.finish());
722-
let c_extra_filename = UnitHash(c_extra_filename_hasher.finish());
721+
let c_metadata = UnitHash(Hasher::finish(&c_metadata_hasher));
722+
let c_extra_filename = UnitHash(Hasher::finish(&c_extra_filename_hasher));
723723
let unit_id = c_extra_filename;
724724

725725
let c_extra_filename = use_extra_filename.then_some(c_extra_filename);

src/cargo/core/compiler/compile_kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ impl CompileTarget {
195195
self.name.hash(&mut hasher);
196196
}
197197
}
198-
hasher.finish()
198+
Hasher::finish(&hasher)
199199
}
200200
}

src/cargo/core/compiler/fingerprint/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1561,7 +1561,7 @@ fn calculate_normal(
15611561
local: Mutex::new(local),
15621562
memoized_hash: Mutex::new(None),
15631563
metadata,
1564-
config: config.finish(),
1564+
config: Hasher::finish(&config),
15651565
compile_kind,
15661566
rustflags: extra_flags,
15671567
fs_status: FsStatus::Stale,

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ fn traverse_and_share(
657657
.collect();
658658
// Here, we have recursively traversed this unit's dependencies, and hashed them: we can
659659
// finalize the dep hash.
660-
let new_dep_hash = dep_hash.finish();
660+
let new_dep_hash = Hasher::finish(&dep_hash);
661661

662662
// This is the key part of the sharing process: if the unit is a runtime dependency, whose
663663
// target is the same as the host, we canonicalize the compile kind to `CompileKind::Host`.

src/cargo/util/hex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn to_hex(num: u64) -> String {
1010
pub fn hash_u64<H: Hash>(hashable: H) -> u64 {
1111
let mut hasher = StableHasher::new();
1212
hashable.hash(&mut hasher);
13-
hasher.finish()
13+
Hasher::finish(&hasher)
1414
}
1515

1616
pub fn hash_u64_file(mut file: &File) -> std::io::Result<u64> {
@@ -23,7 +23,7 @@ pub fn hash_u64_file(mut file: &File) -> std::io::Result<u64> {
2323
}
2424
hasher.write(&buf[..n]);
2525
}
26-
Ok(hasher.finish())
26+
Ok(Hasher::finish(&hasher))
2727
}
2828

2929
pub fn short_hash<H: Hash>(hashable: &H) -> String {

src/cargo/util/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ fn rustc_fingerprint(
381381
_ => (),
382382
}
383383

384-
Ok(hasher.finish())
384+
Ok(Hasher::finish(&hasher))
385385
}
386386

387387
fn process_fingerprint(cmd: &ProcessBuilder, extra_fingerprint: u64) -> u64 {
@@ -391,5 +391,5 @@ fn process_fingerprint(cmd: &ProcessBuilder, extra_fingerprint: u64) -> u64 {
391391
let mut env = cmd.get_envs().iter().collect::<Vec<_>>();
392392
env.sort_unstable();
393393
env.hash(&mut hasher);
394-
hasher.finish()
394+
Hasher::finish(&hasher)
395395
}

0 commit comments

Comments
 (0)