Closed mladedav closed 6 months ago
This is not something I want to cover—it's too advanced and I don't want to get buried deeper into the inner mechanics of cargo
's resolver.
If either manifests or the lockfile changes, the cache is bust—and that's a good enough compromise for me.
Motivation
When we have a package
a
, a dependencyb
and its dependencyc
but then we find out that we need to usec
directly, the lockfile will change and with it the generated recipe and everything will need to be rebuilt although the result will be the same.The example looks like this:
This is a bit of a niche optimization but can help sometimes.
Propsed solution
For each package in the worksapce, if it depends on any package directly but also transitively, the direct dependency can be safely erased.
This cannot be used if the direct dependency turns on a feature that would not be turned on otherwise.