diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0609.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0609.md | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0609.md b/compiler/rustc_error_codes/src/error_codes/E0609.md new file mode 100644 index 000000000..a9db34f47 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0609.md @@ -0,0 +1,24 @@ +Attempted to access a non-existent field in a struct. + +Erroneous code example: + +```compile_fail,E0609 +struct StructWithFields { + x: u32, +} + +let s = StructWithFields { x: 0 }; +println!("{}", s.foo); // error: no field `foo` on type `StructWithFields` +``` + +To fix this error, check that you didn't misspell the field's name or that the +field actually exists. Example: + +``` +struct StructWithFields { + x: u32, +} + +let s = StructWithFields { x: 0 }; +println!("{}", s.x); // ok! +``` |