]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | 1| |#![allow(unused_assignments)] |
2 | 2| |// expect-exit-status-1 | |
3 | 3| | | |
fc512014 | 4 | 4| 1|fn main() -> Result<(),u8> { |
29967ef6 XL |
5 | 5| 1| let mut countdown = 10; |
6 | 6| | while | |
7 | 7| 7| countdown | |
8 | 8| 7| > | |
9 | 9| 7| 0 | |
10 | 10| | { | |
11 | 11| | if | |
12 | 12| 7| countdown | |
13 | 13| 7| < | |
14 | 14| 7| 5 | |
15 | 15| | { | |
16 | 16| | return | |
17 | 17| | if | |
18 | 18| 1| countdown | |
19 | 19| 1| > | |
20 | 20| 1| 8 | |
21 | 21| | { | |
22 | 22| 0| Ok(()) | |
23 | 23| | } | |
24 | 24| | else | |
25 | 25| | { | |
26 | 26| 1| Err(1) | |
27 | 27| | } | |
28 | 28| | ; | |
fc512014 | 29 | 29| 6| } |
29967ef6 XL |
30 | 30| 6| countdown |
31 | 31| 6| -= | |
32 | 32| 6| 1 | |
33 | 33| | ; | |
34 | 34| | } | |
35 | 35| 0| Ok(()) | |
36 | 36| 1|} | |
37 | 37| | | |
38 | 38| |// ISSUE(77553): Originally, this test had `Err(1)` on line 22 (instead of `Ok(())`) and | |
39 | 39| |// `std::process::exit(2)` on line 26 (instead of `Err(1)`); and this worked as expected on Linux | |
40 | 40| |// and MacOS. But on Windows (MSVC, at least), the call to `std::process::exit()` exits the program | |
41 | 41| |// without saving the InstrProf coverage counters. The use of `std::process:exit()` is not critical | |
42 | 42| |// to the coverage test for early returns, but this is a limitation that should be fixed. | |
29967ef6 | 43 |