]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/copy_overlapping.rs
76e1e20d2177fba97529d4f467fe8dd8cab3146f
[rust.git] / tests / compile-fail / copy_overlapping.rs
1 //error-pattern: copy_nonoverlapping called on overlapping ranges
2 #![feature(intrinsics)]
3
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);
7 }
8
9 fn main() {
10     let mut data = [0u8; 16];
11     unsafe {
12         let a = data.as_mut_ptr();
13         let b = a.wrapping_offset(1) as *mut _;
14         copy_nonoverlapping(a, b, 2);
15     }
16 }