Skip to content

Commit 8185564

Browse files
committed
Track 'public/private' depenendecy status in fingerprint
1 parent 715d6ac commit 8185564

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cargo/core/compiler/fingerprint.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,13 @@ pub fn prepare_target<'a, 'cfg>(
315315
/// A compilation unit dependency has a fingerprint that is comprised of:
316316
/// * its package ID
317317
/// * its extern crate name
318+
/// * its public/private status
318319
/// * its calculated fingerprint for the dependency
319320
#[derive(Clone)]
320321
struct DepFingerprint {
321322
pkg_id: u64,
322323
name: String,
324+
public: bool,
323325
fingerprint: Arc<Fingerprint>,
324326
}
325327

@@ -429,10 +431,11 @@ impl<'de> Deserialize<'de> for DepFingerprint {
429431
where
430432
D: de::Deserializer<'de>,
431433
{
432-
let (pkg_id, name, hash) = <(u64, String, u64)>::deserialize(d)?;
434+
let (pkg_id, name, public, hash) = <(u64, String, bool, u64)>::deserialize(d)?;
433435
Ok(DepFingerprint {
434436
pkg_id,
435437
name,
438+
public,
436439
fingerprint: Arc::new(Fingerprint {
437440
memoized_hash: Mutex::new(Some(hash)),
438441
..Fingerprint::new()
@@ -850,11 +853,13 @@ impl hash::Hash for Fingerprint {
850853
for DepFingerprint {
851854
pkg_id,
852855
name,
856+
public,
853857
fingerprint,
854858
} in deps
855859
{
856860
pkg_id.hash(h);
857861
name.hash(h);
862+
public.hash(h);
858863
// use memoized dep hashes to avoid exponential blowup
859864
h.write_u64(Fingerprint::hash(fingerprint));
860865
}
@@ -900,6 +905,7 @@ impl DepFingerprint {
900905
) -> CargoResult<DepFingerprint> {
901906
let fingerprint = calculate(cx, dep)?;
902907
let name = cx.bcx.extern_crate_name(parent, dep)?;
908+
let public = cx.bcx.is_public_dependency(parent, dep);
903909

904910
// We need to be careful about what we hash here. We have a goal of
905911
// supporting renaming a project directory and not rebuilding
@@ -920,6 +926,7 @@ impl DepFingerprint {
920926
Ok(DepFingerprint {
921927
pkg_id,
922928
name,
929+
public,
923930
fingerprint,
924931
})
925932
}

0 commit comments

Comments
 (0)