]> git.lizzy.rs Git - rust.git/blob - src/librustc_error_codes/error_codes/E0422.md
Auto merge of #66396 - smmalis37:pythontest, r=alexcrichton
[rust.git] / src / librustc_error_codes / error_codes / E0422.md
1 You are trying to use an identifier that is either undefined or not a struct.
2 Erroneous code example:
3
4 ```compile_fail,E0422
5 fn main () {
6     let x = Foo { x: 1, y: 2 };
7 }
8 ```
9
10 In this case, `Foo` is undefined, so it inherently isn't anything, and
11 definitely not a struct.
12
13 ```compile_fail
14 fn main () {
15     let foo = 1;
16     let x = foo { x: 1, y: 2 };
17 }
18 ```
19
20 In this case, `foo` is defined, but is not a struct, so Rust can't use it as
21 one.