rust/tests/fail/intrinsics/write_bytes_overflow.rs

10 lines
226 B
Rust
Raw Normal View History

use std::mem;
fn main() {
let mut y = 0;
unsafe {
(&mut y as *mut i32).write_bytes(0u8, 1usize << (mem::size_of::<usize>() * 8 - 1));
2022-07-24 07:37:29 -05:00
//~^ ERROR: overflow computing total size of `write_bytes`
}
}