Skip to content

Add a validity testcase for uninhabited variants#4805

Merged
RalfJung merged 1 commit intorust-lang:masterfrom
meithecatte:uninhabited-enum-validity
Feb 4, 2026
Merged

Add a validity testcase for uninhabited variants#4805
RalfJung merged 1 commit intorust-lang:masterfrom
meithecatte:uninhabited-enum-validity

Conversation

@meithecatte
Copy link
Contributor

Found this testcase in a random unmerged branch of mine. Looks like I wrote it as part of my work on rust-lang/rust#138961, and then forgot to submit it when plans wrt the scope of that PR have changed.

I have double checked by grepping for the error message and it looks like we still don't have any similar tests in miri.

@rustbot
Copy link
Collaborator

rustbot commented Jan 4, 2026

Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two.
Please remember to not force-push to the PR branch except when you need to rebase due to a conflict or when the reviewer asks you for it.

@rustbot rustbot added the S-waiting-on-review Status: Waiting for a review to complete label Jan 4, 2026
@meithecatte meithecatte force-pushed the uninhabited-enum-validity branch from 7a2c7c7 to df5113a Compare January 5, 2026 01:19
@RalfJung
Copy link
Member

RalfJung commented Jan 5, 2026

I have double checked by grepping for the error message and it looks like we still don't have any similar tests in miri.

Yeah, we probably mostly test this via const-eval tests... but can't hurt to also have a Miri test for this.

@RalfJung
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: Waiting for the PR author to address review comments and removed S-waiting-on-review Status: Waiting for a review to complete labels Jan 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@meithecatte
Copy link
Contributor Author

So, having looked into this more closely, there's already a quite comprehensive rustc test for this at tests/ui/consts/const-eval/ub-enum.rs, not sure if duplicating it makes sense...

@RalfJung
Copy link
Member

RalfJung commented Feb 2, 2026

Having at least a sort of smoke test also in Miri does make sense I think.

@meithecatte meithecatte force-pushed the uninhabited-enum-validity branch from df5113a to d6f2193 Compare February 3, 2026 16:13
@meithecatte
Copy link
Contributor Author

Okay, I've switched it over to a transmute and added a comment to note where the more comprehensive tests can be found.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Feb 3, 2026
@RalfJung RalfJung added this pull request to the merge queue Feb 4, 2026
@RalfJung
Copy link
Member

RalfJung commented Feb 4, 2026

Thanks!

Merged via the queue into rust-lang:master with commit 87f9dc8 Feb 4, 2026
13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete label Feb 4, 2026
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.

3 participants