Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Attempted to access a non-existent field in a struct.
- Erroneous code example:
- ```
- 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!
- ```
Add Comment
Please, Sign In to add comment