Skip to content
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

Merged
merged 2 commits into from
Nov 12, 2015

Conversation

nikomatsakis
Copy link
Contributor

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 now

r? @Aatch since he's been reviewing the other commits in this series

@larsbergstrom
Copy link
Contributor

It would be great to land this ASAP, since this bug is blocking Servo's rustup :-)

return vec![block];
}

// Test cawndidates where possible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

@nrc
Copy link
Member

nrc commented Nov 11, 2015

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.
@nikomatsakis
Copy link
Contributor Author

@bors r=nrc

@bors
Copy link
Contributor

bors commented Nov 11, 2015

📌 Commit 662232c has been approved by nrc

@nikomatsakis
Copy link
Contributor Author

@bors p=1 (blocking servo)

@bors
Copy link
Contributor

bors commented Nov 11, 2015

⌛ Testing commit 662232c with merge b785ff9...

@bors
Copy link
Contributor

bors commented Nov 11, 2015

💔 Test failed - auto-mac-64-opt

bothered to track down for a regresson test. /me hopes no one notices
@nikomatsakis
Copy link
Contributor Author

@bors r=nrc p=1

@bors
Copy link
Contributor

bors commented Nov 11, 2015

📌 Commit a5e3625 has been approved by nrc

@bors
Copy link
Contributor

bors commented Nov 12, 2015

⌛ Testing commit a5e3625 with merge 20f4e58...

@bors
Copy link
Contributor

bors commented Nov 12, 2015

💔 Test failed - auto-mac-64-opt

Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 12, 2015
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
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 12, 2015
@Manishearth
Copy link
Member

Fails tidy, needs Manishearth@4f65538

bors added a commit that referenced this pull request Nov 12, 2015
@bors bors merged commit a5e3625 into rust-lang:master Nov 12, 2015
@nikomatsakis nikomatsakis deleted the mir-29740 branch March 30, 2016 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants