Closed
Description
Consider the following code (play):
enum E { Var1, Var2, }
struct S { base: E, }
struct Context { s: S, }
fn main() { let _c = Context { s: E::Var1 }; }
It currently yields the following diagnostic messages:
error[E0308]: mismatched types
--> src/main.rs:7:35
|
7 | fn main() { let _c = Context { s: E::Var1 }; }
| ^^^^^^^
| |
| expected struct `S`, found enum `E`
| help: try using a variant of the expected type: `S(E::Var1)`
|
= note: expected type `S`
found type `E`
This line is what I object to:
| help: try using a variant of the expected type: `S(E::Var1)`
It has two problems:
- It uses the terminology
variant
when discussing building up an instance of the structS
. - It uses a tuple struct form in the example rewrite it provides; but our
S
is a braced struct with named fields.