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

rustc: don't trip an assertion for enums with present but uninhabited variants. #50735

Merged
merged 1 commit into from
May 14, 2018

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 14, 2018

Fixes #50731.

r? @nikomatsakis

@eddyb eddyb added the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 14, 2018
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2018
@eddyb
Copy link
Member Author

eddyb commented May 14, 2018

Beta-nominated because the assert failure was introduced in the already-backported #50622.

@nikomatsakis
Copy link
Contributor

@bors r+

cc @rust-lang/compiler -- approving for backport

@bors
Copy link
Contributor

bors commented May 14, 2018

📌 Commit 29b4c7b has been approved by nikomatsakis

@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 May 14, 2018
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label May 14, 2018
@pietroalbini
Copy link
Member

@bors p=80 (added to the backports PR)

@bors
Copy link
Contributor

bors commented May 14, 2018

⌛ Testing commit 29b4c7b with merge 935a2f1...

bors added a commit that referenced this pull request May 14, 2018
rustc: don't trip an assertion for enums with present but uninhabited variants.

Fixes #50731.

r? @nikomatsakis
@@ -888,6 +888,11 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
if x < min { min = x; }
if x > max { max = x; }
}
// We might have no inhabited variants, so pretend there's at least one.
if (min, max) == (i128::max_value(), i128::min_value()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure, is (min, max) = max(), min() correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Jup. These are the initial values for both, so that means the loop was empty or all variants uninhabited

Copy link
Member Author

Choose a reason for hiding this comment

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

(and the loop can't be empty, thanks to a condition much earlier)

@bors
Copy link
Contributor

bors commented May 14, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 935a2f1 to master...

@bors bors merged commit 29b4c7b into rust-lang:master May 14, 2018
@eddyb eddyb deleted the issue-50731 branch May 15, 2018 08:19
@alexcrichton alexcrichton removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 15, 2018
bors added a commit that referenced this pull request May 15, 2018
[beta] Process backports

Merged on master:

* #50648: Fix volatile_store and nontemporal_store
* #50735: rustc: don't trip an assertion for enums with present but uninhabited variants.
* #50693: typeck: Save the index of private fields
* #50748: Update stdsimd module
* #50694: Fix self referential impl Trait substitutions

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. 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.

8 participants