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

test for validity of references pointing to uninhabited types #2125

Merged
merged 3 commits into from
May 18, 2022

Conversation

RalfJung
Copy link
Member

The new tests for rust-lang/rust#97116

@oli-obk
Copy link
Contributor

oli-obk commented May 17, 2022

What are the plans for types like &Option<!> if the discriminant is for Some?

Is it possible to hit other {kind}s than references? The diagnostics are versatile enough. Maybe some tests for boxes or similar could give us more coverage?

@RalfJung
Copy link
Member Author

The code is the same for references and boxes, and I don't want to have a bazillion tests.^^

But I guess I could change one of these tests to use Box rather than a reference.

What are the plans for types like &Option<!> if the discriminant is for Some?

My plan is to never look at the memory a reference points to (as part of validity checking). So we cannot know the value of the discriminant, and hence &Option<!> is fine (as long as it is aligned and dereferencable, as usual).

@RalfJung
Copy link
Member Author

@bors r+

@bors
Copy link
Collaborator

bors commented May 18, 2022

📌 Commit 439f861 has been approved by RalfJung

@bors
Copy link
Collaborator

bors commented May 18, 2022

⌛ Testing commit 439f861 with merge c5f1cdb...

@bors
Copy link
Collaborator

bors commented May 18, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing c5f1cdb to master...

@bors bors merged commit c5f1cdb into rust-lang:master May 18, 2022
@RalfJung RalfJung deleted the ref-validity branch May 18, 2022 08:08
@RalfJung
Copy link
Member Author

@saethlin if you see crates fail that used to work, this might be why.
I'd actually be curious if anything in the wild is affected by this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants