]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/intrinsics/out_of_bounds_ptr_1.rs
organize compile-fail tests in folders
[rust.git] / tests / compile-fail / intrinsics / out_of_bounds_ptr_1.rs
1 // error-pattern: must be in-bounds at offset 5, but is outside bounds of alloc
2 fn main() {
3     let v = [0i8; 4];
4     let x = &v as *const i8;
5     // The error is inside another function, so we cannot match it by line
6     let x = unsafe { x.offset(5) };
7     panic!("this should never print: {:?}", x);
8 }