]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0422.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / 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.