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
Contributor

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

Nadrieril added 8 commits Nov 3, 2019
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).
@varkor

This comment has been minimized.

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

This comment has been minimized.

Copy link

rust-timer commented Dec 2, 2019

Awaiting bors try build completion

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 2, 2019

⌛️ Trying commit 1c1bec2 with merge 057e49b...

bors added a commit that referenced this pull request Dec 2, 2019
Remove hack for top-level or-patterns in match checking

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.

r? @varkor
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 2, 2019

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

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 2, 2019

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

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Dec 2, 2019

Finished benchmarking try commit 057e49b, comparison URL.

@varkor

This comment has been minimized.

Copy link
Member

varkor commented Dec 2, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 2, 2019

📌 Commit 1c1bec2 has been approved by varkor

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Dec 3, 2019

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

@Nadrieril

This comment has been minimized.

Copy link
Contributor Author

Nadrieril commented Dec 3, 2019

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
bors added a commit that referenced this pull request Dec 3, 2019
Rollup of 9 pull requests

Successful merges:

 - #66405 (Tweak `ObligationForest` `NodeState`s)
 - #66651 (Add `enclosing scope` parameter to `rustc_on_unimplemented`)
 - #66730 (remove dependency from libhermit)
 - #66899 (Standard library support for riscv64gc-unknown-linux-gnu)
 - #66904 (Adding docs for keyword match, move)
 - #66927 (Miri core engine: use throw_ub instead of throw_panic)
 - #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 added a commit that referenced this pull request Dec 3, 2019
Rollup of 9 pull requests

Successful merges:

 - #66405 (Tweak `ObligationForest` `NodeState`s)
 - #66651 (Add `enclosing scope` parameter to `rustc_on_unimplemented`)
 - #66730 (remove dependency from libhermit)
 - #66899 (Standard library support for riscv64gc-unknown-linux-gnu)
 - #66904 (Adding docs for keyword match, move)
 - #66927 (Miri core engine: use throw_ub instead of throw_panic)
 - #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
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
5 checks passed
5 checks passed
homu Test successful
Details
pr #20191202.36 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@Nadrieril Nadrieril deleted the Nadrieril:remove-or-pat-hack branch Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.