os-rust/tests/codegen/issues/issue-109328-split_first.rs

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

18 lines
356 B
Rust
Raw Normal View History

2024-05-20 19:52:30 +00:00
//@ 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)
}