mirror of
https://github.com/rust-lang/rust
synced 2024-09-06 01:11:17 +00:00
add codegen test for #109328
This commit is contained in:
parent
ddb94dbd16
commit
7d967ffa8d
17
tests/codegen/issues/issue-109328-split_first.rs
Normal file
17
tests/codegen/issues/issue-109328-split_first.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
//@ compile-flags: -O
|
||||
//@ min-llvm-version: 17
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[no_mangle]
|
||||
// CHECK-LABEL: @foo
|
||||
// CHECK: getelementptr inbounds
|
||||
// CHECK-NEXT: load i64
|
||||
// CHECK-NEXT: icmp eq i64
|
||||
// CHECK-NEXT: br i1
|
||||
#[no_mangle]
|
||||
pub fn foo(input: &mut &[u64]) -> Option<u64> {
|
||||
let (first, rest) = input.split_first()?;
|
||||
*input = rest;
|
||||
Some(*first)
|
||||
}
|
Loading…
Reference in a new issue