]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/copy_null.rs
Auto merge of #871 - RalfJung:miri-rustc-cleanup, r=RalfJung
[rust.git] / tests / compile-fail / copy_null.rs
1 //error-pattern: invalid use of NULL pointer
2
3 fn main() {
4     let mut data = [0u16; 4];
5     let ptr = &mut data[0] as *mut u16;
6     // Even copying 0 elements from NULL should error.
7     unsafe { ptr.copy_from(std::ptr::null(), 0); }
8 }