-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cargo requires a registry update when adding dep that already exists in dag #2895
Comments
cc @wycats After some experimenting with a few dag-modifying ops this is the only one I found that still requires a registry sync. Better than I thought. |
+1 for me (per my comment at #2111 (comment)) Also want to respond to #2811 (comment)
"doesn't need to hit the network" is a little fuzzy - currently cargo says "I need to hit the network to write out a correct new Cargo.lock". I believe this is sane default behaviour (otherwise builds depend on what's already been cached). However
2 seems very hard and potentially extremely slow if no limits are put in place for cargo searching for things, but I can't currently think of a situation where just 1 would be better than 1+2. As a result, I'd like to propose a new flag called |
Cargo previously erroneously updated the registry whenever a new dependency was added on a crate which already exists in the DAG. This commit fixes this behavior by ensuring that if the new dependency matches a previously locked version it uses that instead. This commit involved a bit of refactoring around this logic to be a bit more clear how the locking and "falling back to the registry" is happening. Closes rust-lang#2895 Closes rust-lang#2931
Avoid updating registry when adding existing deps Cargo previously erroneously updated the registry whenever a new dependency was added on a crate which already exists in the DAG. This commit fixes this behavior by ensuring that if the new dependency matches a previously locked version it uses that instead. This commit involved a bit of refactoring around this logic to be a bit more clear how the locking and "falling back to the registry" is happening. Closes #2895
Starting with two projects, with
foo
depending onbar
:If I then add
libc = "0.2.0"
tofoo/Cargo.toml
Cargo will sync the registry. It already has all the info it needs to solve the graph though. Moving dependencies around in the graph is common in large projects, so Cargo should recognize this case and not hit the network.The text was updated successfully, but these errors were encountered: