]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/validity/uninit_float.rs
Auto merge of #103020 - lyming2007:issue-102598-fix, r=jackh726
[rust.git] / src / tools / miri / tests / fail / validity / uninit_float.rs
1 #![allow(deprecated, invalid_value)]
2 // This test is adapted from https://github.com/rust-lang/miri/issues/1340#issue-600900312.
3
4 fn main() {
5     // Deliberately using `mem::uninitialized` to make sure that despite all the mitigations, we consider this UB.
6     // The array avoids a `Scalar` layout which detects uninit without even doing validation.
7     let _val: [f32; 1] = unsafe { std::mem::uninitialized() };
8     //~^ ERROR: uninitialized
9 }