summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building/custom/unwind_terminate.rs
blob: efdf2ddb1d02e981fe90e6ee41713a3bc5397aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// compile-flags: --crate-type=lib
// edition:2021
#![feature(custom_mir, core_intrinsics)]
use core::intrinsics::mir::*;

// CHECK-LABEL: fn f()
// CHECK:       bb1 (cleanup): {
// CHECK-NEXT:  terminate(abi);
#[custom_mir(dialect = "runtime", phase = "optimized")]
pub fn f() {
    mir!(
        {
            Return()
        }
        bb1(cleanup) = {
            UnwindTerminate(ReasonAbi)
        }
    )
}

// CHECK-LABEL: fn g()
// CHECK:       bb1 (cleanup): {
// CHECK-NEXT:  terminate(cleanup);
#[custom_mir(dialect = "runtime", phase = "optimized")]
pub fn g() {
    mir!(
        {
            Return()
        }
        bb1(cleanup) = {
            UnwindTerminate(ReasonInCleanup)
        }
    )
}