fork/rust

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

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

master
2.1 KiB71 linesraw
1error: struct literals are not allowed here
2  --> $DIR/struct-literal-variant-in-if.rs:13:13
3   |
4LL |     if x == E::I { field1: true, field2: 42 } {}
5   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7help: surround the struct literal with parentheses
8   |
9LL |     if x == (E::I { field1: true, field2: 42 }) {}
10   |             +                                 +
11
12error: struct literals are not allowed here
13  --> $DIR/struct-literal-variant-in-if.rs:15:13
14   |
15LL |     if x == E::V { field: false } {}
16   |             ^^^^^^^^^^^^^^^^^^^^^
17   |
18help: surround the struct literal with parentheses
19   |
20LL |     if x == (E::V { field: false }) {}
21   |             +                     +
22
23error: struct literals are not allowed here
24  --> $DIR/struct-literal-variant-in-if.rs:17:13
25   |
26LL |     if x == E::J { field: -42 } {}
27   |             ^^^^^^^^^^^^^^^^^^^
28   |
29help: surround the struct literal with parentheses
30   |
31LL |     if x == (E::J { field: -42 }) {}
32   |             +                   +
33
34error: struct literals are not allowed here
35  --> $DIR/struct-literal-variant-in-if.rs:19:13
36   |
37LL |     if x == E::K { field: "" } {}
38   |             ^^^^^^^^^^^^^^^^^^
39   |
40help: surround the struct literal with parentheses
41   |
42LL |     if x == (E::K { field: "" }) {}
43   |             +                  +
44
45error[E0533]: expected value, found struct variant `E::V`
46  --> $DIR/struct-literal-variant-in-if.rs:10:13
47   |
48LL |     if x == E::V { field } {}
49   |             ^^^^ not a value
50
51error[E0308]: mismatched types
52  --> $DIR/struct-literal-variant-in-if.rs:10:20
53   |
54LL |     if x == E::V { field } {}
55   |     ---------------^^^^^--
56   |     |              |
57   |     |              expected `()`, found `bool`
58   |     expected this to be `()`
59
60error[E0308]: mismatched types
61  --> $DIR/struct-literal-variant-in-if.rs:21:20
62   |
63LL |     let y: usize = ();
64   |            -----   ^^ expected `usize`, found `()`
65   |            |
66   |            expected due to this
67
68error: aborting due to 7 previous errors
69
70Some errors have detailed explanations: E0308, E0533.
71For more information about an error, try `rustc --explain E0308`.