]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | A structure-literal syntax was used to create an item that is not a structure |
2 | or enum variant. | |
3 | ||
4 | Example of erroneous code: | |
5 | ||
6 | ```compile_fail,E0071 | |
7 | type U32 = u32; | |
8 | let t = U32 { value: 4 }; // error: expected struct, variant or union type, | |
9 | // found builtin type `u32` | |
10 | ``` | |
11 | ||
12 | To fix this, ensure that the name was correctly spelled, and that the correct | |
13 | form of initializer was used. | |
14 | ||
15 | For example, the code above can be fixed to: | |
16 | ||
17 | ``` | |
18 | enum Foo { | |
19 | FirstValue(i32) | |
20 | } | |
21 | ||
22 | fn main() { | |
23 | let u = Foo::FirstValue(0i32); | |
24 | ||
25 | let t = 4; | |
26 | } | |
27 | ``` |