Skip to content

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

let val = 1u32;
let ptr = (&raw const val).cast::<E>();
unsafe { ptr.read() }; //~ ERROR: encountered an uninhabited enum variant
Copy link
Member

Choose a reason for hiding this comment

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

A simple transmute from 1u32 should have the same result, right? That would even take care of the size check.

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Waiting for a review to complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants