Error codes

E0221: unknown field

In a terminal: auk explain E0221 prints this page.

On this page

The struct has no field with this name. The note lists its fields and may suggest the one you meant.

Wrong#

auk
struct User { name: str }
fn hello(u: User): str = "hi {u.nmae}"

Fixed#

auk
struct User { name: str }
fn hello(u: User): str = "hi {u.name}"

Common causes#

  • A typo in the field name.
  • A method called without parentheses (xs.len instead of xs.len()).
  • Reading a field from the wrong struct type.

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page