fork/rust

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

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

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