rust/tests/fail/intrinsics/copy_overflow.rs

11 lines
219 B
Rust
Raw Normal View History

2021-03-10 08:21:12 -06:00
// error-pattern: overflow computing total size
use std::mem;
fn main() {
let x = 0;
let mut y = 0;
unsafe {
(&mut y as *mut i32).copy_from(&x, 1usize << (mem::size_of::<usize>() * 8 - 1));
}
}