-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: add MacroPat to isExhaustiveMatch #17746
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
8a3c8fc
to
493a68a
Compare
@@ -149,6 +152,8 @@ private predicate isExhaustiveMatch(Pat pat) { | |||
or | |||
pat = parent.(IdentPat).getPat() | |||
or | |||
pat = parent.(MacroPat).getMacroCall().getExpanded() |
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.
Why is this necessary and L143 not enough?
If I understand correctly the cases here are about the exhaustiveness property flowing from patterns to their child constituents. This added line doesn't seem to really fit that pattern?
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.
Line 143 is for cases where a macro expands to a pattern that is known to be exhaustive (eg a wildcard) in that case the macro invocation is an exhaustive pattern.
Line 155 is for the case where a macro invocation appears in a position that should be exhaustive, such as the last arm in a match. In this case whatever the macro expands to is considered to be exhaustive as well.
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, now I get it 😄
Co-authored-by: Simon Friis Vindum <simonfv@gmail.com>
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.
LGTM 🎉
@hvitved