about summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/uninit/uninit_byte_read.rs
blob: 9bc2b4338b0db1160c6628f9e02fa68fc185acc3 (plain)
1
2
3
4
5
6
7
//@compile-flags: -Zmiri-disable-stacked-borrows
fn main() {
    let v: Vec<u8> = Vec::with_capacity(10);
    let undef = unsafe { *v.as_ptr().add(5) }; //~ ERROR: uninitialized
    let x = undef + 1;
    panic!("this should never print: {}", x);
}