2020-03-08 17:34:54 -05:00
|
|
|
// error-pattern: outside bounds of alloc
|
2018-10-08 04:22:52 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = Box::into_raw(Box::new(0u32));
|
2019-02-15 19:43:56 -06:00
|
|
|
let x = x.wrapping_offset(8); // ok, this has no inbounds tag
|
2018-10-08 04:22:52 -05:00
|
|
|
let _x = unsafe { x.offset(0) }; // UB despite offset 0, the pointer is not inbounds of the only object it can point to
|
|
|
|
}
|