]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/intrinsics/out_of_bounds_ptr_2.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / intrinsics / out_of_bounds_ptr_2.rs
1 // error-pattern: overflowing in-bounds pointer arithmetic
2 fn main() {
3     let v = [0i8; 4];
4     let x = &v as *const i8;
5     let x = unsafe { x.offset(-1) };
6     panic!("this should never print: {:?}", x);
7 }