Skip to content
/ rustc Public
forked from rust-lang/rust

Commit

Permalink
add codegen test for rust-lang#109328
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 9, 2024
1 parent ddb94db commit 7d967ff
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/codegen/issues/issue-109328-split_first.rs
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 7d967ff

Please sign in to comment.