-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Automatically update patch
, and provide better errors if an update is not possible.
#8248
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b78cb37
Provide better error messages for a bad `patch`.
ehuss afa3ace
Make patches automatically update if updated.
ehuss 2c0cd97
Simplify error handling.
ehuss 6fd11a7
Don't include a special-case error for a locked patch matching 0 entr…
ehuss 5dde9cc
Show patch location in error message.
ehuss 4f2bae9
Revert change to automatically select the greatest patch match.
ehuss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
This makes me a bit hesitant here trying to handle multiple candidates being returned. When
[patch]
was originally implemented we didn't have custom registries yet, so the only real usage of[patch]
was pointing togit
andpath
, neither of which can possibly have multiple versions of a package. With custom registries, though, that's now possible!My main worry is that the candidates here don't participate in the normal version resolution of everything else. The biggest version may not always be the right one to pick (with other constraints like
links
and such).Could this continue to restrict to only one package? I think it's fine to allow more candidates, but I think what should be done is to add all the candidates to "these can be searched through with version resolution". Version resolution would then do its normal thing to pick which is the best.
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'm not sure if I'm understanding correctly. If you're saying that this function should return multiple summaries, the problem is that any of the entries that aren't selected during version resolution end up in the unused patch list which triggers a warning.
I guess it could group related summaries together, so that the "unused patch" logic could only mark them unused if none in the group were used. However, that would require changes in lots of places (which I'd rather not do right now).
Unless you meant something else, should I just switch it back to an error (maybe with a suggestion to use an
=
version requirement)?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.
Oh sorry, let me clarify. Primarily this is a change in behavior from today which I'm worried about, so I would prefer to switch it back to make multiple candidates an error.
Other than that I was thinking that we probably could support this, but not by picking a version here and instead letting version resolution later pick a version. The theoretical idea behind
[patch]
was "take this crate and assume it comes from that source". That same idea works for "take this set of crates and assume they all come from that source", but the code here just isn't structured to do that. Ideally what we should do here is that when there's an unlocked (the only way to return multiple versions) dependency we make all matching candidates available for version resolution from the resolver, and the resolver picks one we'd then lock. If it ends up being entirely unused then we could pick the biggest one to lock and it wouldn't be an issue.Does that make sense?