-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add a description of Cargo.lock
conflicts in the Cargo FAQ
#12092
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
Conversation
r? @weihanglo (rustbot has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I am not certain if we can add that message unconditionally. Most of the common dependency conflicts cannot be resolved by cargo generate-lockfile
. I didn't think much when writing down the fix. Can you help me think of any scenario where the suggestion is considered harmful or useless?
BTW I am more looking forward to an FAQ though it might be wordy and not easy to write one. |
Thank you for your guidance. For now, I've modified some of the test cases to make it pass. Perhaps, as you say, for some scenarios that require more in-depth analysis, I'll go ahead with the work. Oh, I'm going to try to add answers to the frequently asked questions, which may be a bit difficult for me to satisfy everyone, but I'll do my best. |
…o lock-conflict * 'master' of https://github.com/QiangHeisenberg/cargo: (148 commits) doc: intra-doc links and doc comments for build script Adding a member should check with moderation. Leader selection with no objections. Remove useless drop of copy type Update comment to add more context. Fix dep/feat syntax with hidden implicit optional dependencies changelog: add entries of some behavior changes Update the semver-check script to be able to run in any directory. Clarify unsafe to safe function qualifier change. Fix typo Do not take a stance on #![deny(warnings)] Note that it is not a breaking change to make an `unsafe` function safe Change to <bin-name> Update libc to 0.2.144 Add more documentation for artifact-dependencies. Add missing period. Disallow RUSTUP_TOOLCHAIN in the [env] table. Add a comment describing why these are disallowed. Disallow RUSTUP_HOME in the [env] table. Update git2 ...
Allow me to explain a little bit. As you said, it may not be appropriate to use the order aaaa suggested in the error message. I described some scenarios in PR, hope my understanding is correct. If I understand something wrong or explain it not clearly enough, I hope you can point it out. |
Cargo.lock
conflicts in the Cargo FAQ
src/doc/src/faq.md
Outdated
or merging branches, it is recommended to try to run `cargo generate-lockfile` to | ||
solve it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally wouldn't recommend this. cargo generate-lockfile
will update all dependencies, which is usually not what is wanted.
I think most conflicts can be trivially resolved manually. The format is not that complicated, and editing manually shouldn't be such a concern.
I would say that if there are non-trivial conflicts, you can reset all "yours" changes, fix all other conflicts in the branch, and then run some cargo command (like cargo tree
or cargo check
), which should re-update the lockfile with your own local changes. If you previously ran some cargo update
commands in your branch, you can re-run them that this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most conflicts can be trivially resolved manually. The format is not that complicated, and editing manually shouldn't be such a concern.
Even fairly familiar with cargo, I do not attempt to resolve conflicts on my own
I would say that if there are non-trivial conflicts, you can reset all "yours" changes, fix all other conflicts in the branch, and then run some cargo command (like cargo tree or cargo check), which should re-update the lockfile with your own local change
This is what I do to resolve conflicts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I think it's pretty good enough. Just some minor issues need to resolve and then we can move forward. We can always polish it afterward.
Thank you very much for your guidance. If I still have mistakes, please feel free to point them out, and I will take the time to modify them:) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging this, @qiangheisenberg could you do a squash or else to make the git history more meaningful?
Okay. I meant there are 6 commits in the history and some of them seem irrelevant or misleading, e.g., "Merge branch master". It is a good practice to keep the history clean. Anyhow, I'll merge this sooner or later if you haven't got time to cleanup git commits. Thank you! |
Very sorry for my unprofessional manner. I'm not very good at dealing with this problem, so I had to re-open a PR. |
What does this PR try to resolve?
Add a message for issue #12079.
I haven't figured out how to add a new entry to the Cargo FAQ yet. If it does need to be added, I will add it later.