2019-04-18 18:35:11 +00:00
|
|
|
error: struct literals are not allowed here
|
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:13:13
|
|
|
|
|
|
|
|
|
LL | if x == E::I { field1: true, field2: 42 } {}
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2019-05-02 22:53:09 +00:00
|
|
|
help: surround the struct literal with parentheses
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == (E::I { field1: true, field2: 42 }) {}
|
2021-06-22 02:07:19 +00:00
|
|
|
| + +
|
2019-04-18 18:35:11 +00:00
|
|
|
|
2019-04-18 20:58:57 +00:00
|
|
|
error: struct literals are not allowed here
|
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:15:13
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == E::V { field: false } {}
|
2019-04-18 20:58:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2019-05-02 22:53:09 +00:00
|
|
|
help: surround the struct literal with parentheses
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
2019-04-18 20:58:57 +00:00
|
|
|
LL | if x == (E::V { field: false }) {}
|
2021-06-22 02:07:19 +00:00
|
|
|
| + +
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
error: struct literals are not allowed here
|
2019-04-18 20:58:57 +00:00
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:17:13
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == E::J { field: -42 } {}
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2019-05-02 22:53:09 +00:00
|
|
|
help: surround the struct literal with parentheses
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == (E::J { field: -42 }) {}
|
2021-06-22 02:07:19 +00:00
|
|
|
| + +
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
error: struct literals are not allowed here
|
2019-04-18 20:58:57 +00:00
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:19:13
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == E::K { field: "" } {}
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2019-10-24 05:20:58 +00:00
|
|
|
|
|
2019-05-02 22:53:09 +00:00
|
|
|
help: surround the struct literal with parentheses
|
2019-04-18 18:35:11 +00:00
|
|
|
|
|
|
|
|
LL | if x == (E::K { field: "" }) {}
|
2021-06-22 02:07:19 +00:00
|
|
|
| + +
|
2019-04-18 18:35:11 +00:00
|
|
|
|
2022-10-25 16:15:15 +00:00
|
|
|
error[E0533]: expected value, found struct variant `E::V`
|
2019-04-18 18:35:11 +00:00
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:10:13
|
2019-04-15 15:08:46 +00:00
|
|
|
|
|
|
|
|
LL | if x == E::V { field } {}
|
2020-08-10 04:24:05 +00:00
|
|
|
| ^^^^ not a value
|
2024-07-11 16:23:03 +00:00
|
|
|
|
|
|
|
|
help: you might have meant to create a new value of the struct
|
|
|
|
|
|
|
|
|
LL | if x == (E::V { field }) {}
|
|
|
|
| + +
|
2019-04-15 15:08:46 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-04-18 18:35:11 +00:00
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:10:20
|
2019-04-15 15:08:46 +00:00
|
|
|
|
|
|
|
|
LL | if x == E::V { field } {}
|
2021-02-05 01:36:06 +00:00
|
|
|
| ---------------^^^^^--
|
2019-09-27 00:16:34 +00:00
|
|
|
| | |
|
2019-11-15 17:37:01 +00:00
|
|
|
| | expected `()`, found `bool`
|
2019-09-27 00:16:34 +00:00
|
|
|
| expected this to be `()`
|
2019-04-15 15:08:46 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2019-04-18 20:58:57 +00:00
|
|
|
--> $DIR/struct-literal-variant-in-if.rs:21:20
|
2019-04-15 15:08:46 +00:00
|
|
|
|
|
|
|
|
LL | let y: usize = ();
|
2019-11-19 05:00:24 +00:00
|
|
|
| ----- ^^ expected `usize`, found `()`
|
|
|
|
| |
|
|
|
|
| expected due to this
|
2019-04-15 15:08:46 +00:00
|
|
|
|
2019-04-18 20:58:57 +00:00
|
|
|
error: aborting due to 7 previous errors
|
2019-04-15 15:08:46 +00:00
|
|
|
|
2022-10-25 16:15:15 +00:00
|
|
|
Some errors have detailed explanations: E0308, E0533.
|
2019-04-15 15:08:46 +00:00
|
|
|
For more information about an error, try `rustc --explain E0308`.
|