rust/tests/fail/validity/uninit_raw_ptr.rs

8 lines
255 B
Rust
Raw Normal View History

#![allow(invalid_value)]
2021-10-29 18:40:20 -05:00
fn main() {
// The array avoids a `Scalar` layout which detects uninit without even doing validation.
let _val = unsafe { std::mem::MaybeUninit::<[*const u8; 1]>::uninit().assume_init() };
//~^ ERROR: uninitialized
2021-10-29 18:40:20 -05:00
}