Error codes

E0224: missing fields in a struct literal

In a terminal: auk explain E0224 prints this page.

On this page

A struct literal must give every field a value; Auk has no implicit defaults. Copy the rest from another value with ..base if that's what you mean.

Wrong#

auk
struct P { x: int, y: int }
fn origin(): P = P { x: 0 }

Fixed#

auk
struct P { x: int, y: int }
fn origin(): P = P { x: 0, y: 0 }

Common causes#

  • A field added to the struct but not to every literal.
  • Expecting fields to default to zero or empty.
  • Updating one field: write P { x: 1, ..p }.

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