diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0422.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0422.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0422.md b/compiler/rustc_error_codes/src/error_codes/E0422.md new file mode 100644 index 000000000..828a52e73 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0422.md @@ -0,0 +1,22 @@ +An identifier that is neither defined nor a struct was used. + +Erroneous code example: + +```compile_fail,E0422 +fn main () { + let x = Foo { x: 1, y: 2 }; +} +``` + +In this case, `Foo` is undefined, so it inherently isn't anything, and +definitely not a struct. + +```compile_fail +fn main () { + let foo = 1; + let x = foo { x: 1, y: 2 }; +} +``` + +In this case, `foo` is defined, but is not a struct, so Rust can't use it as +one. |