mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
ec7a188f16
``` error[E0533]: expected value, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:18:14 | LL | let e3 = E::Empty3; | ^^^^^^^^^ not a value | help: you might have meant to create a new value of the struct | LL | let e3 = E::Empty3 {}; | ++ ``` ``` error[E0533]: expected value, found struct variant `E::V` --> $DIR/struct-literal-variant-in-if.rs:10:13 | LL | if x == E::V { field } {} | ^^^^ not a value | help: you might have meant to create a new value of the struct | LL | if x == (E::V { field }) {} | + + ``` ``` error[E0618]: expected function, found enum variant `Enum::Unit` --> $DIR/suggestion-highlights.rs:15:5 | LL | Unit, | ---- enum variant `Enum::Unit` defined here ... LL | Enum::Unit(); | ^^^^^^^^^^-- | | | call expression requires function | help: `Enum::Unit` is a unit enum variant, and does not take parentheses to be constructed | LL - Enum::Unit(); LL + Enum::Unit; | ``` ``` error[E0599]: no variant or associated item named `tuple` found for enum `Enum` in the current scope --> $DIR/suggestion-highlights.rs:36:11 | LL | enum Enum { | --------- variant or associated item `tuple` not found for this enum ... LL | Enum::tuple; | ^^^^^ variant or associated item not found in `Enum` | help: there is a variant with a similar name | LL | Enum::Tuple(/* i32 */); | ~~~~~~~~~~~~~~~~; | ```
77 lines
2.3 KiB
Plaintext
77 lines
2.3 KiB
Plaintext
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 } {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: surround the struct literal with parentheses
|
|
|
|
|
LL | if x == (E::I { field1: true, field2: 42 }) {}
|
|
| + +
|
|
|
|
error: struct literals are not allowed here
|
|
--> $DIR/struct-literal-variant-in-if.rs:15:13
|
|
|
|
|
LL | if x == E::V { field: false } {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: surround the struct literal with parentheses
|
|
|
|
|
LL | if x == (E::V { field: false }) {}
|
|
| + +
|
|
|
|
error: struct literals are not allowed here
|
|
--> $DIR/struct-literal-variant-in-if.rs:17:13
|
|
|
|
|
LL | if x == E::J { field: -42 } {}
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: surround the struct literal with parentheses
|
|
|
|
|
LL | if x == (E::J { field: -42 }) {}
|
|
| + +
|
|
|
|
error: struct literals are not allowed here
|
|
--> $DIR/struct-literal-variant-in-if.rs:19:13
|
|
|
|
|
LL | if x == E::K { field: "" } {}
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: surround the struct literal with parentheses
|
|
|
|
|
LL | if x == (E::K { field: "" }) {}
|
|
| + +
|
|
|
|
error[E0533]: expected value, found struct variant `E::V`
|
|
--> $DIR/struct-literal-variant-in-if.rs:10:13
|
|
|
|
|
LL | if x == E::V { field } {}
|
|
| ^^^^ not a value
|
|
|
|
|
help: you might have meant to create a new value of the struct
|
|
|
|
|
LL | if x == (E::V { field }) {}
|
|
| + +
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/struct-literal-variant-in-if.rs:10:20
|
|
|
|
|
LL | if x == E::V { field } {}
|
|
| ---------------^^^^^--
|
|
| | |
|
|
| | expected `()`, found `bool`
|
|
| expected this to be `()`
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/struct-literal-variant-in-if.rs:21:20
|
|
|
|
|
LL | let y: usize = ();
|
|
| ----- ^^ expected `usize`, found `()`
|
|
| |
|
|
| expected due to this
|
|
|
|
error: aborting due to 7 previous errors
|
|
|
|
Some errors have detailed explanations: E0308, E0533.
|
|
For more information about an error, try `rustc --explain E0308`.
|