1 //error-pattern: invalid use of NULL pointer
2 #![feature(intrinsics)]
4 // Directly call intrinsic to avoid debug assertions in libstd
5 extern "rust-intrinsic" {
6 fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
10 let mut data = [0u16; 4];
11 let ptr = &mut data[0] as *mut u16;
12 // Even copying 0 elements from NULL should error.
13 unsafe { copy_nonoverlapping(std::ptr::null(), ptr, 0); }