2024-04-20 06:19:34 -05:00
|
|
|
//@ test-mir-pass: InstSimplify
|
2024-03-10 03:29:39 -05:00
|
|
|
//@ compile-flags: -Cdebug-assertions=no -Zinline-mir
|
|
|
|
|
|
|
|
// EMIT_MIR ub_check.unwrap_unchecked.InstSimplify.diff
|
|
|
|
pub fn unwrap_unchecked(x: Option<i32>) -> i32 {
|
|
|
|
// CHECK-LABEL: fn unwrap_unchecked(
|
|
|
|
// CHECK-NOT: UbChecks()
|
|
|
|
// CHECK: [[assume:_.*]] = const false;
|
|
|
|
// CHECK-NEXT: assume([[assume]]);
|
|
|
|
// CHECK-NEXT: unreachable_unchecked::precondition_check
|
|
|
|
unsafe { x.unwrap_unchecked() }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unwrap_unchecked(None);
|
|
|
|
}
|