]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0422.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0422.md
1 An identifier that is neither defined nor a struct was used.
2
3 Erroneous code example:
4
5 ```compile_fail,E0422
6 fn main () {
7 let x = Foo { x: 1, y: 2 };
8 }
9 ```
10
11 In this case, `Foo` is undefined, so it inherently isn't anything, and
12 definitely not a struct.
13
14 ```compile_fail
15 fn main () {
16 let foo = 1;
17 let x = foo { x: 1, y: 2 };
18 }
19 ```
20
21 In this case, `foo` is defined, but is not a struct, so Rust can't use it as
22 one.