Fix cargo update
with unused patch.
#8243
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you end up with an unused patch in
Cargo.lock
, then you try to update the patch to a version that does not match the original unused patch, and runcargo update
, Cargo refuses to update it with the error "patch forbar
inhttps://github.com/rust-lang/crates.io-index
did not resolve to any crates". At this point, Cargo seems to be permanently stuck with no way to update it (unless you manually editCargo.lock
).The solution here is to add the unused patches to the "to_avoid" list, so that
cargo update
is allowed to update them.I am uncertain if this is the best way to fix it, but seems to match my intuition of how
cargo update
is implemented.