-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Constant gets evaluated even when it contains invalid transmute
#79047
Comments
The same issue also arises with |
Is it really the same issue? My understanding is the rust/compiler/rustc_passes/src/intrinsicck.rs Lines 71 to 124 in 85e355e
So I think it's possible that we have two different bugs here. |
Well, maybe not exactly the same issue, but something very similar at least. |
Consider the following code:
This code hits a peculiar code path in the interpreter:
rust/compiler/rustc_mir/src/interpret/place.rs
Lines 916 to 927 in 30e49a9
This code path should be unreachable: just like the interpreter can assume that code code it runs on is well-typed, it should be able to assume that the code it runs on has its transmutes checked. But something seems to be different about
transmute
when compared with "normal" type-checking.TransmuteSizeDiff
is a hack; we should instead arrange things in a way that failing the transmute check inhibits const-evaluation the same way thattrue + 4
inhibitis const-evaluation.The text was updated successfully, but these errors were encountered: