diff --git a/tests/codegen/issues/issue-74938-array-split-at.rs b/tests/codegen/issues/issue-74938-array-split-at.rs new file mode 100644 index 0000000000000..1f8aa3868d75f --- /dev/null +++ b/tests/codegen/issues/issue-74938-array-split-at.rs @@ -0,0 +1,15 @@ +//@ compile-flags: -O + +#![crate_type = "lib"] + +const N: usize = 3; +pub type T = u8; + +#[no_mangle] +// CHECK-LABEL: @split_mutiple +// CHECK-NOT: unreachable +pub fn split_mutiple(slice: &[T]) -> (&[T], &[T]) { + let len = slice.len() / N; + slice.split_at(len * N) +} +