Error codes

E0225: unknown or duplicate field in a struct literal or pattern

In a terminal: auk explain E0225 prints this page.

On this page

A struct literal or pattern names a field the struct doesn't have, or names one field twice. The note lists the struct's fields.

Wrong#

auk
struct P { x: int }
fn make(): P = P { x: 1, z: 2 }

Fixed#

auk
struct P { x: int }
fn make(): P = P { x: 1 }

Common causes#

  • A typo in a field name.
  • A field that was renamed or removed from the struct.
  • A field given twice, e.g. once directly and once by shorthand.

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