]>
git.proxmox.com Git - rustc.git/blob - tests/codegen/try_question_mark_nop.rs
1 // min-llvm-version: 15.0
2 // compile-flags: -O -Z merge-functions=disabled --edition=2021
6 #![feature(try_blocks)]
8 // These are now NOPs in LLVM 15, presumably thanks to nikic's change mentioned in
9 // <https://github.com/rust-lang/rust/issues/85133#issuecomment-1072168354>.
10 // Unfortunately, as of 2022-08-17 they're not yet nops for `u64`s nor `Option`.
12 use std
::ops
::ControlFlow
::{self, Continue, Break}
;
14 // CHECK-LABEL: @result_nop_match_32
16 pub fn result_nop_match_32(x
: Result
<i32, u32>) -> Result
<i32, u32> {
18 // CHECK-NEXT: ret i64 %0
25 // CHECK-LABEL: @result_nop_traits_32
27 pub fn result_nop_traits_32(x
: Result
<i32, u32>) -> Result
<i32, u32> {
29 // CHECK-NEXT: ret i64 %0
35 // CHECK-LABEL: @control_flow_nop_match_32
37 pub fn control_flow_nop_match_32(x
: ControlFlow
<i32, u32>) -> ControlFlow
<i32, u32> {
39 // CHECK-NEXT: ret i64 %0
41 Continue(x
) => Continue(x
),
46 // CHECK-LABEL: @control_flow_nop_traits_32
48 pub fn control_flow_nop_traits_32(x
: ControlFlow
<i32, u32>) -> ControlFlow
<i32, u32> {
50 // CHECK-NEXT: ret i64 %0