-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
clippy ICE: normalization works on validated constants: InterpErrorInfo #101113
Comments
Unlike #100771 I was not able to reproduce this one with rustc and |
I'm surprised that even compiles. My guess is |
A much simpler MCVE that triggers this same ICE: const UNINIT: core::mem::MaybeUninit<core::cell::Cell<&'static ()>> =
core::mem::MaybeUninit::uninit();
fn main() {} running today's clippy (Clippy version: clippy 0.1.65 (59e7a30 2022-09-11)) on this source causes the ICE in this issue. Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c5643cbd7ce11d350c914088429b6e2e |
Before anyone asks "why would you create a constant that contains a Cell" the answer is that this is inside a macro where we wanted to create a const UNINIT: core::mem::MaybeUninit<core::cell::Cell<&'static ()>> =
core::mem::MaybeUninit::uninit();
static mut BUF: [MaybeUninit<Cell<&'static ()>>; $LEN] = [UNINIT; $LEN]; |
Ignore the previous. Looks like the active union field isn't kept track of in the value. |
Don't lint `*_interior_mutable_const` on unions due to potential ICE. fixes #9445 cc rust-lang/rust#101113 This started ICE'ing sometime last month due to stricter UB checks. I'm not sure how we could check the value of a union as MIRI doesn't seem to store which field is currently active. changelog: Don't ICE on const unions containing a `!Freeze` type.
Code
This happens with clippy
clippy 0.1.65 (eaadb89 2022-08-27)
(master toolchain) but not with clippy nightlyclippy 0.1.65 (c07a8b4 2022-08-26)
, since clippy was not updated in a week I strongly suspect that this is caused by some underlying rustc change :/The text was updated successfully, but these errors were encountered: