-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Change match desugaring to degenerate to if-else-if chains #29776
Conversation
92434c6
to
e7ff18d
Compare
It would be great to land this ASAP, since this bug is blocking Servo's rustup :-) |
return vec![block]; | ||
} | ||
|
||
// Test cawndidates where possible. |
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.
typo
r+ with the typos fixed |
large matches that fallback to Eq. When we encounter a case where the test being performed does not inform the candidate at all, we just stop testing the candidates at that point, rather than adding the candidate to both outcomes. The former behavior was not WRONG, but it generated a lot of code, whereas this new behavior degenerates to an if-else-if tree. Fixes rust-lang#29740.
e7ff18d
to
662232c
Compare
@bors r=nrc |
📌 Commit 662232c has been approved by |
@bors p=1 (blocking servo) |
⌛ Testing commit 662232c with merge b785ff9... |
💔 Test failed - auto-mac-64-opt |
bothered to track down for a regresson test. /me hopes no one notices
@bors r=nrc p=1 |
📌 Commit a5e3625 has been approved by |
⌛ Testing commit a5e3625 with merge 20f4e58... |
💔 Test failed - auto-mac-64-opt |
In previous PRs, I changed the match desugaring to generate more efficient code for ints/chars and the like. But this doesn't help when you're matching strings, ranges, or other crazy complex things (leading to rust-lang#29740). This commit restructures match desugaring *yet again* to handle that case better -- basically we now degenerate to an if-else-if chain in such cases. ~~Note that this builds on rust-lang#29763 which will hopefully land soon. So ignore the first few commits.~~ landed now r? @Aatch since he's been reviewing the other commits in this series
Fails tidy, needs Manishearth@4f65538 |
In previous PRs, I changed the match desugaring to generate more efficient code for ints/chars and the like. But this doesn't help when you're matching strings, ranges, or other crazy complex things (leading to #29740). This commit restructures match desugaring yet again to handle that case better -- basically we now degenerate to an if-else-if chain in such cases.
Note that this builds on #29763 which will hopefully land soon. So ignore the first few commits.landed nowr? @Aatch since he's been reviewing the other commits in this series