fork/rust

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

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

master
1.3 KiB41 linesraw
1   LL|       |#![allow(unused_assignments, unused_variables)]
2   LL|       |
3   LL|      1|fn main() {
4   LL|      1|    // Initialize test constants in a way that cannot be determined at compile time, to ensure
5   LL|      1|    // rustc and LLVM cannot optimize out statements (or coverage counters) downstream from
6   LL|      1|    // dependent conditions.
7   LL|      1|    let is_true = std::env::args().len() == 1;
8   LL|      1|
9   LL|      1|    let mut countdown = 0;
10   LL|      1|    if
11   LL|      1|        is_true
12   LL|      1|    {
13   LL|      1|        countdown
14   LL|      1|        =
15   LL|      1|            10
16   LL|      1|        ;
17   LL|      1|    }
18   LL|       |    else // Note coverage region difference without semicolon
19   LL|       |    {
20   LL|      0|        countdown
21   LL|      0|        =
22   LL|      0|            100
23   LL|       |    }
24   LL|       |
25   LL|       |    if
26   LL|      1|        is_true
27   LL|      1|    {
28   LL|      1|        countdown
29   LL|      1|        =
30   LL|      1|            10
31   LL|      1|        ;
32   LL|      1|    }
33   LL|       |    else
34   LL|      0|    {
35   LL|      0|        countdown
36   LL|      0|        =
37   LL|      0|            100
38   LL|      0|        ;
39   LL|      0|    }
40   LL|      1|}
41