summary refs log tree commit diff
path: root/src/tools/miri/tests/fail/uninit_byte_read.rs
blob: f1dace0cff9b1742073c64881cf83e12011b20a0 (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.get_unchecked(5) }; //~ ERROR: uninitialized
    let x = undef + 1;
    panic!("this should never print: {}", x);
}