about summary refs log tree commit diff
path: root/tests/codegen-llvm/issues/issue-98294-get-mut-copy-from-slice-opt.rs
blob: 76adcf9fd4530487970b9410ac9572d2c5a7b248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//@ compile-flags: -Copt-level=3

#![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);
    }
}