mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
20 lines
491 B
Rust
20 lines
491 B
Rust
|
// min-llvm-version: 15.0.0
|
||
|
// ignore-debug: The debug assertions get in the way
|
||
|
// compile-flags: -O
|
||
|
|
||
|
#![crate_type = "lib"]
|
||
|
|
||
|
// There should be no calls to panic / len_mismatch_fail.
|
||
|
|
||
|
#[no_mangle]
|
||
|
pub fn test(a: &mut [u8], offset: usize, bytes: &[u8]) {
|
||
|
// CHECK-LABEL: @test(
|
||
|
// CHECK-NOT: call
|
||
|
// CHECK: call void @llvm.memcpy
|
||
|
// CHECK-NOT: call
|
||
|
// CHECK: }
|
||
|
if let Some(dst) = a.get_mut(offset..offset + bytes.len()) {
|
||
|
dst.copy_from_slice(bytes);
|
||
|
}
|
||
|
}
|