-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Allow Or patterns in IfLet guard #103194
Allow Or patterns in IfLet guard #103194
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
The job Click to see the possible cause of the failure (guessed by this bot)
|
// This makes it so we only use last 'pat' in 'Or' pattern. | ||
// See issue #88015 for more info. | ||
if let PatKind::Or(pats) = &arm.pat.kind && self.is_guard_if_let(arm){ | ||
pat = self.lower_pat(pats.last().unwrap()); |
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.
Won't this lost parts of the patters in the or pattern? Doesn't this change the meaning of the program?
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.
Hmm, this is indeed the wrong way to approach this problem, going to close it as I look for a new solution.
As mentioned in #88015 each subpattern creates a new local for 'x' which confuses the borrow checker about its initialization.
Fixes #88015