Fix collapsible_match suggestion causing non-exhaustive pattern error#16865
Open
JasmineLCY wants to merge 2 commits intorust-lang:masterfrom
Open
Fix collapsible_match suggestion causing non-exhaustive pattern error#16865JasmineLCY wants to merge 2 commits intorust-lang:masterfrom
collapsible_match suggestion causing non-exhaustive pattern error#16865JasmineLCY wants to merge 2 commits intorust-lang:masterfrom
Conversation
When collapsing a bare `if` inside a match arm into a match guard, the else arm's pattern must be a true wildcard for exhaustiveness. If the else arm is `None` (which `arm_is_wild_like` considers wild-like but isn't a true wildcard for exhaustiveness), the suggestion now replaces it with `_`. Fixes rust-lang#16860 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
r? @dswij rustbot has assigned @dswij. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Collaborator
|
|
Lintcheck changes for de932e4
This comment will be updated if you push new changes |
Member
|
Please:
|
Collaborator
|
☔ The latest upstream changes (possibly #16878) made this pull request unmergeable. Please resolve the merge conflicts. |
Author
|
Sorry for the slow response — I missed this. I'll address each point:
Working on it. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When collapsing a bare
ifinside a match arm into a match guard, the else arm's pattern must be a true wildcard for exhaustiveness. If the else arm isNone(whicharm_is_wild_likeconsiders wild-like but isn't a true wildcard for exhaustiveness), the suggestion now replaces it with_.Drafted with AI assistance, reviewed and tested by me.
Fixes #16860
changelog: Fix [
collapsible_match] suggestion causing non-exhaustive patterns error when else arm is not a wildcard