about summary refs log tree commit diff
path: root/tests/mir-opt/coverage/branch_match_arms.rs
blob: 84ffddcb289486c5f7e833cb2592cbf982d07512 (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
//@ test-mir-pass: InstrumentCoverage
//@ compile-flags: -Cinstrument-coverage -Zno-profiler-runtime -Zcoverage-options=branch
// skip-filecheck

enum Enum {
    A(u32),
    B(u32),
    C(u32),
    D(u32),
}

// EMIT_MIR branch_match_arms.main.InstrumentCoverage.diff
fn main() {
    match Enum::A(0) {
        Enum::D(d) => consume(d),
        Enum::C(c) => consume(c),
        Enum::B(b) => consume(b),
        Enum::A(a) => consume(a),
    }
}

#[inline(never)]
#[coverage(off)]
fn consume(x: u32) {
    core::hint::black_box(x);
}