rust/tests/codegen/issues/issue-74938-array-split-at.rs
Lzu Tao f9edd864df Apply suggestions from code review
Co-authored-by: Nikita Popov <github@npopov.com>
2024-06-09 13:25:12 +00:00

15 lines
270 B
Rust

//@ compile-flags: -O
#![crate_type = "lib"]
const N: usize = 3;
pub type T = u8;
// CHECK-LABEL: @split_multiple
// CHECK-NOT: unreachable
#[no_mangle]
pub fn split_multiple(slice: &[T]) -> (&[T], &[T]) {
let len = slice.len() / N;
slice.split_at(len * N)
}