rust/tests/codegen/issues/issue-74938-array-split-at.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
270 B
Rust
Raw Permalink Normal View History

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