Skip to content

Commit 7a396f0

Browse files
committed
refactor(fingerprint): Separate Metadata lookup from Metadata::meta_hash lookup
1 parent 92de1a2 commit 7a396f0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,12 @@ fn compute_metadata(
588588
metas: &mut HashMap<Unit, Metadata>,
589589
) -> Metadata {
590590
let bcx = &build_runner.bcx;
591+
let deps_metadata = build_runner
592+
.unit_deps(unit)
593+
.iter()
594+
.map(|dep| *metadata_of(&dep.unit, build_runner, metas))
595+
.collect::<Vec<_>>();
596+
591597
let mut hasher = StableHasher::new();
592598

593599
METADATA_VERSION.hash(&mut hasher);
@@ -604,13 +610,12 @@ fn compute_metadata(
604610
unit.features.hash(&mut hasher);
605611

606612
// Mix in the target-metadata of all the dependencies of this target.
607-
let mut deps_metadata = build_runner
608-
.unit_deps(unit)
613+
let mut dep_hashes = deps_metadata
609614
.iter()
610-
.map(|dep| metadata_of(&dep.unit, build_runner, metas).meta_hash)
615+
.map(|m| m.meta_hash)
611616
.collect::<Vec<_>>();
612-
deps_metadata.sort();
613-
deps_metadata.hash(&mut hasher);
617+
dep_hashes.sort();
618+
dep_hashes.hash(&mut hasher);
614619

615620
// Throw in the profile we're compiling with. This helps caching
616621
// `panic=abort` and `panic=unwind` artifacts, additionally with various

0 commit comments

Comments
 (0)