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

MIR: terminate unreachable blocks in construct_const #46877

Merged
merged 1 commit into from Dec 21, 2017

Conversation

Projects
None yet
8 participants
@Deewiant
Contributor

Deewiant commented Dec 20, 2017

Fixes #46843.

#45821 added unreachable blocks in matches, which were terminated in
construct_fn but not in construct_const, causing a panic due to "no
terminator on block" when constants involved matching on enums.

The "unimplemented expression type" error may go away in the future, the
key is that we see the E0015 about using a non-const function and then
don't ICE.

MIR: terminate unreachable blocks in construct_const
Fixes #46843.

#45821 added unreachable blocks in matches, which were terminated in
construct_fn but not in construct_const, causing a panic due to "no
terminator on block" when constants involved matching on enums.

The "unimplemented expression type" error may go away in the future, the
key is that we see the E0015 about using a non-const function and then
don't ICE.
@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Dec 20, 2017

Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Collaborator

rust-highfive commented Dec 20, 2017

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

if let Some(unreachable_block) = builder.cached_unreachable_block {
builder.cfg.terminate(unreachable_block, source_info,
TerminatorKind::Unreachable);
}

This comment has been minimized.

@eddyb

eddyb Dec 20, 2017

Member

If this is also in construct_fn, can it be moved to Builder::finish?

@eddyb

eddyb Dec 20, 2017

Member

If this is also in construct_fn, can it be moved to Builder::finish?

This comment has been minimized.

@Deewiant

Deewiant Dec 20, 2017

Contributor

Maybe, but it's not obvious to me how that could happen. The call to terminate depends on source_info which is defined differently here than in construct_fn, and doesn't seem like it could be obtained in a general fashion in Builder::finish.

@Deewiant

Deewiant Dec 20, 2017

Contributor

Maybe, but it's not obvious to me how that could happen. The call to terminate depends on source_info which is defined differently here than in construct_fn, and doesn't seem like it could be obtained in a general fashion in Builder::finish.

@eddyb

This comment has been minimized.

Show comment
Hide comment
@eddyb
Member

eddyb commented Dec 20, 2017

@bors r+

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 20, 2017

Contributor

📌 Commit 8dfc47a has been approved by eddyb

Contributor

bors commented Dec 20, 2017

📌 Commit 8dfc47a has been approved by eddyb

@arielb1

This comment has been minimized.

Show comment
Hide comment
@arielb1

arielb1 Dec 21, 2017

Contributor

@bors p=1

Contributor

arielb1 commented Dec 21, 2017

@bors p=1

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 21, 2017

Contributor

⌛️ Testing commit 8dfc47a with merge b7b52cc...

Contributor

bors commented Dec 21, 2017

⌛️ Testing commit 8dfc47a with merge b7b52cc...

bors added a commit that referenced this pull request Dec 21, 2017

Auto merge of #46877 - Deewiant:gh46843, r=eddyb
MIR: terminate unreachable blocks in construct_const

Fixes #46843.

#45821 added unreachable blocks in matches, which were terminated in
construct_fn but not in construct_const, causing a panic due to "no
terminator on block" when constants involved matching on enums.

The "unimplemented expression type" error may go away in the future, the
key is that we see the E0015 about using a non-const function and then
don't ICE.
@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Dec 21, 2017

Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing b7b52cc to master...

Contributor

bors commented Dec 21, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: eddyb
Pushing b7b52cc to master...

@bors bors merged commit 8dfc47a into rust-lang:master Dec 21, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@Deewiant Deewiant deleted the Deewiant:gh46843 branch Dec 21, 2017

@nagisa nagisa added the T-compiler label Jan 7, 2018

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jan 10, 2018

Member

Looks like we forgot to backport this for 1.23.0 (sorry about that!) so removing beta tags

Member

alexcrichton commented Jan 10, 2018

Looks like we forgot to backport this for 1.23.0 (sorry about that!) so removing beta tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment