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