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

ensure that statics are inhabited #78324

Merged
merged 3 commits into from
Oct 26, 2020
Merged

Conversation

RalfJung
Copy link
Member

Fixes #74840

r? @oli-obk

Co-authored-by: BlackHoleFox <blackholefoxdev@gmail.com>
extern {
static VOID: Void; //~ ERROR static of uninhabited type
//~| WARN: previously accepted
static NEVER: !; //~ ERROR static of uninhabited type
Copy link
Contributor

Choose a reason for hiding this comment

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

does the diagnostic for a regular static NEVER: ! = panic!(); change with this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, looks like it does (see the test change I just pushed)... would you prefer it to only apply to foreign items?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, having tests for it is good, I'm mostly suprised we don't have any other tests for this

@oli-obk
Copy link
Contributor

oli-obk commented Oct 25, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Oct 25, 2020

📌 Commit 3bd5cc9 has been approved by oli-obk

@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 Oct 25, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Oct 25, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Oct 25, 2020
@bors
Copy link
Contributor

bors commented Oct 26, 2020

⌛ Testing commit 3bd5cc9 with merge b9a94c9...

@bors
Copy link
Contributor

bors commented Oct 26, 2020

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing b9a94c9 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 26, 2020
@bors bors merged commit b9a94c9 into rust-lang:master Oct 26, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 26, 2020
@RalfJung RalfJung deleted the uninhabited-statics branch October 26, 2020 11:44
@hellow554 hellow554 mentioned this pull request Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

Creating a raw reference/pointer to an extern never value claims following code is unreachable
6 participants