]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/issue-98294-get-mut-copy-from-slice-opt.rs
Rollup merge of #103168 - Amanieu:stable_asm_sym, r=davidtwco
[rust.git] / src / test / codegen / issue-98294-get-mut-copy-from-slice-opt.rs
1 // min-llvm-version: 15.0.0
2 // ignore-debug: The debug assertions get in the way
3 // compile-flags: -O
4
5 #![crate_type = "lib"]
6
7 // There should be no calls to panic / len_mismatch_fail.
8
9 #[no_mangle]
10 pub fn test(a: &mut [u8], offset: usize, bytes: &[u8]) {
11     // CHECK-LABEL: @test(
12     // CHECK-NOT: call
13     // CHECK: call void @llvm.memcpy
14     // CHECK-NOT: call
15     // CHECK: }
16     if let Some(dst) = a.get_mut(offset..offset + bytes.len()) {
17         dst.copy_from_slice(bytes);
18     }
19 }