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.
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
fix: Provide path to avoid UTF-8 panics #2677
fix: Provide path to avoid UTF-8 panics #2677
Changes from all commits
aeaf01e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can you please add ui tests for all the aborts you added?
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 just duplicated existing aborts, just moving them up earlier in the process. I at least confirmed the subcommand abort is already covered
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.
Both the aborts are for different scenarios, so, I would still expect different tests here since this scenario is not covered.
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.
To be clear which aborts we are talking about, I'm assuming you are referring to
and
To boil these two aborts down, they are:
Vec
inside external subcommandsThese checks were added to
gen_augment
but already exist ingen_from_arg_matches
and are already covered byclap_derive/tests/ui/external_subcommand_wrong_type.rs
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.
Okay, so you said you duplicated 2 aborts in this PR from old code.
The first one is this which is duplicated from this. Since
gen_from_arg_matches
is called first beforegen_augment
is called, we don't need the new abort. We can guarantee that new abort never triggers which means we need anINTERNAL_ERR
panic here.The second one is this which is duplicated from this. But we are not handling
Vec<String>
here which means the phrasing here should be different. And we need to make sure both the phrasings are tested.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.
Updated the comment with edits to make it more clearer.
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.
Having one function abort on behalf of both functions creates a behavior dependency between them that is non-obvious and can easily break as code is refactored in the future.
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 was thinking about asking to move this to be above both of these functions. But this is too much time/discussion for a simple thing. Forget about the first abort. Let's just resolve the second abort as described above.
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 went ahead though the other one has precedence so the change does not show up in error messages.