Fingerprint of dependency changing when building crate in workspace vs individually

I'm building a crate in the workspace that depends on serde_yaml. When i build in the workspace root, it builds everything, but when i rebuild just that specific crate with cargo build -p <crate> it requires a rebuild because it says

dirty: UnitDependencyInfoChanged { old_name: "serde_yaml", old_fingerprint: 336827626433690992, new_name: "serde_yaml", new_fingerprint: 485260544305850671 }

Other searches and help online says that this is due to feature flags, but here we do not specify any different feature flags... is there something else that might be causing this issue?

1 Like

if cargo build -p uses a different cache, then there should be no changes that causes a rebuild because they are separated from each other. if they share the same cache, then there should also be no reason to rebuild because the dependency should be already built. this seems to indicate that only some dependencies are shared between the two caches?

Shot in the dark:
maybe there are multiple dependency paths leading to the inclusion of serde_yaml. If they specify distinct sets of feature flags the resulting fingerprint would be different.

Fingerprint of dependency in workspace changes when running cargo build and cargo build -p <crate> · Issue #12345 · rust-lang/cargo (github.com)

Created bug report here as i have a minimal working reproduction

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.