]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/dangling_pointers/out_of_bounds_read1.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / dangling_pointers / out_of_bounds_read1.rs
1 fn main() {
2     let v: Vec<u8> = vec![1, 2];
3     let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR outside bounds of alloc
4     panic!("this should never print: {}", x);
5 }