Base fill-match-arms suggestions on the exhaustiveness checker - #23100
Open
rit3sh-x wants to merge 1 commit into
Open
Base fill-match-arms suggestions on the exhaustiveness checker#23100rit3sh-x wants to merge 1 commit into
rit3sh-x wants to merge 1 commit into
Conversation
Contributor
|
It's sad that you worked on this since I already have a working branch (and I've said that multiple times). Given that, if this is already in good shape, I'll merge this, but if not, I'll not engage in in review rounds and just close this. Thank you for your interest in contribution anyway! |
Contributor
Author
|
@ChayimFriedman2 bad timing is my forte 😅, feel free to address my issues. |
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.
Fixes #8129.
What changed
add_missing_match_armsnow asks the exhaustiveness checker for the patterns actually missing from amatch(via a newmissing_match_arm_patternsquery added tohir-tyand exposed throughSemantics), instead of only enumerating the scrutinee's top-level enum variants. This covers arms nested inside tuples, structs, references, andOption, and no longer produces the invalid catch-all rewrite from "Fill match arms" code action creates non-exhaustive match #8129 when a wildcard arm hides a real gap.crates/hir-ty/src/diagnostics/expr.rs::UncoveredPattern<Var>, a generic witness-shape type shared betweenhir-ty(parameterized overVariantId) andhir(parameterized overVariantviamap_variant), rather than two independent copies of the same enum.Testing
crates/ide-assists/src/handlers/add_missing_match_arms.rsexercising nested variants, record fields, or-patterns, guards, hidden variants, self-referential enums, andSelf-qualified paths.AI Usage