rust/tests/compile-fail/intrinsics/copy_overflow.rs
2020-04-11 11:36:55 +02:00

11 lines
229 B
Rust

// error-pattern: overflow computing total size of `copy`
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));
}
}