]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/undefined_byte_read.rs
Auto merge of #1354 - divergentdave:dump-alloc-on-undef-read, r=RalfJung
[rust.git] / tests / compile-fail / undefined_byte_read.rs
1 fn main() {
2     let v: Vec<u8> = Vec::with_capacity(10);
3     let undef = unsafe { *v.get_unchecked(5) };
4     let x = undef + 1; //~ ERROR this operation requires initialized memory
5     panic!("this should never print: {}", x);
6 }