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

Remove hack for top-level or-patterns in match checking #66967

Merged
merged 8 commits into from
Dec 3, 2019

Conversation

Nadrieril
Copy link
Member

@Nadrieril Nadrieril commented Dec 2, 2019

Follow-up to #66612.

Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the unreachable_patterns lint a bit more general.

cc #54883

r? @varkor

The exact same logic was used in check_arms and check_match to build the
matrix of relevant patterns. It would actually probably have been a bug
if it was not the case, since exhaustiveness checking should be the same
as checking reachability of an additional `_ => ...` match branch.
We want the lifetimes of the patterns contained in the matrix and the
candidate `PatStack` to be the same so that they can be mixed together.
A lot of this would not be necessary if `SmallVec` was covariant in its
type argument (see servo/rust-smallvec#146).
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 2, 2019
@varkor
Copy link
Member

varkor commented Dec 2, 2019

The implementation looks good. Some of the pre-existing comments could do with a drive-by clean up (capitalisation, etc.), though I'm not too bothered. Let's just make sure this doesn't regress anything.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Dec 2, 2019

⌛ Trying commit 1c1bec2 with merge 057e49b53cffec15c0a8467b83fe961b5f476e83...

@bors
Copy link
Contributor

bors commented Dec 2, 2019

☀️ Try build successful - checks-azure
Build commit: 057e49b53cffec15c0a8467b83fe961b5f476e83 (057e49b53cffec15c0a8467b83fe961b5f476e83)

@rust-timer
Copy link
Collaborator

Queued 057e49b53cffec15c0a8467b83fe961b5f476e83 with parent 2da942f, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 057e49b53cffec15c0a8467b83fe961b5f476e83, comparison URL.

@varkor
Copy link
Member

varkor commented Dec 2, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Dec 2, 2019

📌 Commit 1c1bec2 has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 2, 2019
@Centril Centril added the F-or_patterns `#![feature(or_patterns)]` label Dec 2, 2019
@Centril
Copy link
Contributor

Centril commented Dec 3, 2019

@Nadrieril This looks great! Thanks a bunch for all the work you've been doing on match checking!

@Nadrieril
Copy link
Member Author

I have to say I'm having a lot of fun doing it :D. And you all are really reactive and supportive too, thanks !

Centril added a commit to Centril/rust that referenced this pull request Dec 3, 2019
Remove hack for top-level or-patterns in match checking

Follow-up to rust-lang#66612.

Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the `unreachable_patterns` lint a bit more general.

cc rust-lang#54883

r? @varkor
Centril added a commit to Centril/rust that referenced this pull request Dec 3, 2019
Remove hack for top-level or-patterns in match checking

Follow-up to rust-lang#66612.

Or-patterns are now truly first-class in match checking. As a side-effect, redundant subpatterns are linted as such, making the `unreachable_patterns` lint a bit more general.

cc rust-lang#54883

r? @varkor
bors added a commit that referenced this pull request Dec 3, 2019
Rollup of 6 pull requests

Successful merges:

 - #66148 (Show the sign for signed ops on `exact_div`)
 - #66651 (Add `enclosing scope` parameter to `rustc_on_unimplemented`)
 - #66904 (Adding docs for keyword match, move)
 - #66935 (syntax: Unify macro and attribute arguments in AST)
 - #66941 (Remove `ord` lang item)
 - #66967 (Remove hack for top-level or-patterns in match checking)

Failed merges:

r? @ghost
@bors bors merged commit 1c1bec2 into rust-lang:master Dec 3, 2019
@Nadrieril Nadrieril deleted the remove-or-pat-hack branch December 3, 2019 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-or_patterns `#![feature(or_patterns)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants