]> git.lizzy.rs Git - rust.git/blob - src/test/run-make/coverage/simple_match.rs
Auto merge of #100595 - matthiaskrgr:rollup-f1zur58, r=matthiaskrgr
[rust.git] / src / test / run-make / coverage / simple_match.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 = 1;
10     if is_true {
11         countdown = 0;
12     }
13
14     for
15         _
16     in
17         0..2
18     {
19         let z
20         ;
21         match
22             countdown
23         {
24             x
25             if
26                 x
27                     <
28                 1
29             =>
30             {
31                 z = countdown
32                 ;
33                 let y = countdown
34                 ;
35                 countdown = 10
36                 ;
37             }
38             _
39             =>
40             {}
41         }
42     }
43 }