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

Commit

Permalink
add codegen test for rust-lang#68667
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 9, 2024
1 parent bf17818 commit 5f527eb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/codegen/issues/issue-68667-unwrap-combinators.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![crate_type = "lib"]

//@ compile-flags: -O

// MIR inlining now optimizes this code.

// CHECK-LABEL: @unwrap_combinators
// CHECK: icmp
// CHECK-NEXT: icmp
// CHECK-NEXT: select i1
// CHECK-NEXT: ret i1
#[no_mangle]
pub fn unwrap_combinators(a: Option<i32>, b: i32) -> bool {
a.map(|t| t >= b)
.unwrap_or(false)
}

0 comments on commit 5f527eb

Please sign in to comment.