fork/rust

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

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

master
1.9 KiB64 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 a, mut b, mut c) = (0, 0, 0);
10   LL|      1|    if is_true {
11   LL|      1|        a = 1;
12   LL|      1|        b = 10;
13   LL|      1|        c = 100;
14   LL|      1|    }
15                   ^0
16   LL|       |    let
17   LL|      1|        somebool
18   LL|       |        =
19   LL|      1|            a < b
20   LL|       |        ||
21   LL|      0|            b < c
22   LL|       |    ;
23   LL|       |    let
24   LL|      1|        somebool
25   LL|       |        =
26   LL|      1|            b < a
27   LL|       |        ||
28   LL|      1|            b < c
29   LL|       |    ;
30   LL|      1|    let somebool = a < b && b < c;
31   LL|      1|    let somebool = b < a && b < c;
32                                          ^0
33   LL|       |
34   LL|       |    if
35   LL|       |        !
36   LL|      1|        is_true
37   LL|      0|    {
38   LL|      0|        a = 2
39   LL|      0|        ;
40   LL|      1|    }
41   LL|       |
42   LL|       |    if
43   LL|      1|        is_true
44   LL|      1|    {
45   LL|      1|        b = 30
46   LL|      1|        ;
47   LL|      1|    }
48   LL|       |    else
49   LL|      0|    {
50   LL|      0|        c = 400
51   LL|      0|        ;
52   LL|      0|    }
53   LL|       |
54   LL|      1|    if !is_true {
55   LL|      0|        a = 2;
56   LL|      1|    }
57   LL|       |
58   LL|      1|    if is_true {
59   LL|      1|        b = 30;
60   LL|      1|    } else {
61   LL|      0|        c = 400;
62   LL|      0|    }
63   LL|      1|}
64