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

Fix an ICE when attempting to transmute an uninhabited type #50803

Merged
merged 2 commits into from
May 20, 2018

Conversation

varkor
Copy link
Member

@varkor varkor commented May 16, 2018

Fixes #50570.

@rust-highfive
Copy link
Collaborator

r? @petrochenkov

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 16, 2018
@rust-highfive

This comment has been minimized.

@varkor varkor force-pushed the never-transmute-never branch from 23cc8da to e6c9a68 Compare May 16, 2018 14:32
f(x)
}

fn main() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This test doesn't seem to trigger the ICE on current nightly. Possibly because the unused functions get never codegen'd?

NB: I would have expected a compile-pass test instead of run-pass (and with suitable crate type to avoid the dummy main)

Copy link
Member Author

@varkor varkor May 16, 2018

Choose a reason for hiding this comment

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

Good point on both counts — I've updated the test; thanks.

@varkor varkor force-pushed the never-transmute-never branch from e6c9a68 to d5de930 Compare May 16, 2018 20:26
@petrochenkov
Copy link
Contributor

r? @eddyb

@rust-highfive rust-highfive assigned eddyb and unassigned petrochenkov May 16, 2018
// we can do what we like. Here, we declare that transmuting
// into an uninhabited type is impossible, so anything following
// it must be unreachable.
bx.unreachable();
Copy link
Member

@eddyb eddyb May 17, 2018

Choose a reason for hiding this comment

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

Could you assert_eq!(bx.cx.layout_of(sig.output()).abi, Abi::Uninhabited) here?

@eddyb
Copy link
Member

eddyb commented May 17, 2018

@bors r+

@bors
Copy link
Contributor

bors commented May 17, 2018

📌 Commit d8cba6b has been approved by eddyb

@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 17, 2018
@bors
Copy link
Contributor

bors commented May 17, 2018

☔ The latest upstream changes (presumably #50615) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 17, 2018
@varkor varkor force-pushed the never-transmute-never branch from d8cba6b to e172330 Compare May 17, 2018 17:14
@varkor varkor force-pushed the never-transmute-never branch 2 times, most recently from a400529 to f900333 Compare May 17, 2018 17:16
@eddyb
Copy link
Member

eddyb commented May 17, 2018

@bors r+

@bors
Copy link
Contributor

bors commented May 17, 2018

📌 Commit f900333 has been approved by eddyb

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 17, 2018
@bors
Copy link
Contributor

bors commented May 20, 2018

⌛ Testing commit f900333 with merge 21ea121...

bors added a commit that referenced this pull request May 20, 2018
Fix an ICE when attempting to transmute an uninhabited type

Fixes #50570.
@bors
Copy link
Contributor

bors commented May 20, 2018

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

@bors bors merged commit f900333 into rust-lang:master May 20, 2018
@varkor varkor deleted the never-transmute-never branch May 20, 2018 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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