fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.6 KiB48 linesraw
1   LL|      1|fn main() {
2   LL|      1|    // Initialize test constants in a way that cannot be determined at compile time, to ensure
3   LL|      1|    // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
4   LL|      1|    // dependent conditions.
5   LL|      1|    let is_true = std::env::args().len() == 1;
6   LL|      1|
7   LL|      1|    let mut a: u8 = 0;
8   LL|      1|    let mut b: u8 = 0;
9   LL|      1|    if is_true {
10   LL|      1|        a = 2;
11   LL|      1|        b = 0;
12   LL|      1|    }
13                   ^0
14   LL|      1|    match (a, b) {
15   LL|       |        // Or patterns generate MIR `SwitchInt` with multiple targets to the same `BasicBlock`.
16   LL|       |        // This test confirms a fix for Issue #79569.
17   LL|      0|        (0 | 1, 2 | 3) => {}
18   LL|      1|        _ => {}
19   LL|       |    }
20   LL|      1|    if is_true {
21   LL|      1|        a = 0;
22   LL|      1|        b = 0;
23   LL|      1|    }
24                   ^0
25   LL|      1|    match (a, b) {
26   LL|      0|        (0 | 1, 2 | 3) => {}
27   LL|      1|        _ => {}
28   LL|       |    }
29   LL|      1|    if is_true {
30   LL|      1|        a = 2;
31   LL|      1|        b = 2;
32   LL|      1|    }
33                   ^0
34   LL|      1|    match (a, b) {
35   LL|      0|        (0 | 1, 2 | 3) => {}
36   LL|      1|        _ => {}
37   LL|       |    }
38   LL|      1|    if is_true {
39   LL|      1|        a = 0;
40   LL|      1|        b = 2;
41   LL|      1|    }
42                   ^0
43   LL|      1|    match (a, b) {
44   LL|      1|        (0 | 1, 2 | 3) => {}
45   LL|      0|        _ => {}
46   LL|       |    }
47   LL|      1|}
48