mirror of
https://github.com/rust-lang/cargo
synced 2024-10-01 13:33:38 +00:00
Track 'public/private' depenendecy status in fingerprint
This commit is contained in:
parent
715d6ace02
commit
8185564a53
|
@ -315,11 +315,13 @@ pub fn prepare_target<'a, 'cfg>(
|
|||
/// A compilation unit dependency has a fingerprint that is comprised of:
|
||||
/// * its package ID
|
||||
/// * its extern crate name
|
||||
/// * its public/private status
|
||||
/// * its calculated fingerprint for the dependency
|
||||
#[derive(Clone)]
|
||||
struct DepFingerprint {
|
||||
pkg_id: u64,
|
||||
name: String,
|
||||
public: bool,
|
||||
fingerprint: Arc<Fingerprint>,
|
||||
}
|
||||
|
||||
|
@ -429,10 +431,11 @@ impl<'de> Deserialize<'de> for DepFingerprint {
|
|||
where
|
||||
D: de::Deserializer<'de>,
|
||||
{
|
||||
let (pkg_id, name, hash) = <(u64, String, u64)>::deserialize(d)?;
|
||||
let (pkg_id, name, public, hash) = <(u64, String, bool, u64)>::deserialize(d)?;
|
||||
Ok(DepFingerprint {
|
||||
pkg_id,
|
||||
name,
|
||||
public,
|
||||
fingerprint: Arc::new(Fingerprint {
|
||||
memoized_hash: Mutex::new(Some(hash)),
|
||||
..Fingerprint::new()
|
||||
|
@ -850,11 +853,13 @@ impl hash::Hash for Fingerprint {
|
|||
for DepFingerprint {
|
||||
pkg_id,
|
||||
name,
|
||||
public,
|
||||
fingerprint,
|
||||
} in deps
|
||||
{
|
||||
pkg_id.hash(h);
|
||||
name.hash(h);
|
||||
public.hash(h);
|
||||
// use memoized dep hashes to avoid exponential blowup
|
||||
h.write_u64(Fingerprint::hash(fingerprint));
|
||||
}
|
||||
|
@ -900,6 +905,7 @@ impl DepFingerprint {
|
|||
) -> CargoResult<DepFingerprint> {
|
||||
let fingerprint = calculate(cx, dep)?;
|
||||
let name = cx.bcx.extern_crate_name(parent, dep)?;
|
||||
let public = cx.bcx.is_public_dependency(parent, dep);
|
||||
|
||||
// We need to be careful about what we hash here. We have a goal of
|
||||
// supporting renaming a project directory and not rebuilding
|
||||
|
@ -920,6 +926,7 @@ impl DepFingerprint {
|
|||
Ok(DepFingerprint {
|
||||
pkg_id,
|
||||
name,
|
||||
public,
|
||||
fingerprint,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue