-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Moves in guard expressions aren't handled properly #22073
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
Comments
I'm working on a fix for both of these issues. Should be done fairly soon I hope. |
@Aatch whoa, I thought we didn't support moves into guards in the first place? (That is, not that I object to you fixing this ... but I had thought there was an explicit decision not to support such guards, at least not in the short term, because we were not confident we could make it work!) Am I mistaken? |
@pnkfelix Well I managed to get it to work (you're actually assigned to the PR fixing it). You may be thinking of mutation in guards though, since that's disallowed. |
@Aatch ah that is what I was thinking of, indeed. (My mind isn't made up about whether it makes sense to support moves into guards; if we got away with disallowing mutation, why not moves as well, at least for the short term.) |
1.0 beta, P-backcompat-lang. |
(this comment was accidentally posted here, and has moved to: #22075 (comment) ) |
Update the graphviz tests accordingly. Fixes rust-lang#22073. (Includes regression test for the issue.) (Factoring of aatch CFG code, Part 4.)
aatch's cfg revisions, namely to match expressions Revise handling of match expressions so that arms branch to next arm. Update the graphviz tests accordingly. Fixes rust-lang#22073. (Includes regression test for the issue.)
This code causes a segfault (without optimisations on):
as does this similar code:
This is because the current control flow graph essentially visits each arm in parallel. With multiple patterns, each pattern within the arm is visited, then the guard is visited after all the patterns have been visited, even though this doesn't reflect the real semantics (we visit the pattern, then the guard, then the next pattern, then the guard again).
The text was updated successfully, but these errors were encountered: