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

Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns #69891

Merged
merged 1 commit into from Mar 11, 2020

Conversation

@Centril
Copy link
Member

Centril commented Mar 10, 2020

There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.

Here we preserve this broken invariant by recursively expanding PatKind::Ors in Matrix::push.
Fixes #69875.

r? @varkor
cc @Nadrieril
cc #54883

@Centril Centril force-pushed the Centril:fix-69875 branch from e8e0274 to 4d16c21 Mar 10, 2020
@varkor

This comment has been minimized.

Copy link
Member

varkor commented Mar 10, 2020

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 10, 2020

📌 Commit 4d16c21 has been approved by varkor

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 10, 2020

🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened

Centril added a commit to Centril/rust that referenced this pull request Mar 11, 2020
Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns

> There's an implicit invariant that there should be no or-patterns directly in the first column of the matrix, but this invariant is broken exactly when an or-pattern has a child that is itself an or-pattern.

Here we preserve this broken invariant by recursively expanding `PatKind::Or`s in `Matrix::push`.
Fixes rust-lang#69875.

r? @varkor
cc @Nadrieril
cc rust-lang#54883
bors added a commit that referenced this pull request Mar 11, 2020
Rollup of 10 pull requests

Successful merges:

 - #66059 (mem::zeroed/uninit: panic on types that do not permit zero-initialization)
 - #69373 (Stabilize const for integer {to,from}_{be,le,ne}_bytes methods)
 - #69591 (Use TypeRelating for instantiating query responses)
 - #69645 (const forget tests)
 - #69766 (Make Point `Copy` in arithmetic documentation)
 - #69825 (make `mem::discriminant` const)
 - #69859 (fix #62456)
 - #69881 (VariantSizeDifferences: bail on SizeOverflow)
 - #69891 (Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns)
 - #69896 (parse: Tweak the function parameter edition check)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Mar 11, 2020
Rollup of 10 pull requests

Successful merges:

 - #66059 (mem::zeroed/uninit: panic on types that do not permit zero-initialization)
 - #69373 (Stabilize const for integer {to,from}_{be,le,ne}_bytes methods)
 - #69591 (Use TypeRelating for instantiating query responses)
 - #69625 (Implement nth, last, and count for iter::Copied)
 - #69645 (const forget tests)
 - #69766 (Make Point `Copy` in arithmetic documentation)
 - #69825 (make `mem::discriminant` const)
 - #69859 (fix #62456)
 - #69891 (Exhaustiveness checking, `Matrix::push`: recursively expand or-patterns)
 - #69896 (parse: Tweak the function parameter edition check)

Failed merges:

r? @ghost
@bors bors merged commit a05bab5 into rust-lang:master Mar 11, 2020
4 checks passed
4 checks passed
pr Build #20200310.52 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
@Centril Centril deleted the Centril:fix-69875 branch Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.