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