]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/out_of_bounds_ptr_1.rs
20bcc36f049d1c000770fd9d9334875b874c367f
[rust.git] / tests / compile-fail / 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 }