gcc/testsuite/rust/execute/torture/copy_nonoverlapping1.rs
raw| 1 | #![feature(intrinsics)] |
| 2 | #[lang = "sized"] |
| 3 | pub trait Sized {} |
| 4 | |
| 5 | extern "rust-intrinsic" { |
| 6 | pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize); |
| 7 | } |
| 8 | |
| 9 | fn main() -> i32 { |
| 10 | let i = 15; |
| 11 | let mut i_copy = 16; |
| 12 | |
| 13 | let i = &i as *const i32; |
| 14 | let i_copy = &mut i_copy as *mut i32; |
| 15 | |
| 16 | unsafe { |
| 17 | copy_nonoverlapping(i, i_copy, 1); |
| 18 | |
| 19 | *i_copy - *i |
| 20 | } |
| 21 | } |