Building an enum variant takes exactly one value per field, in order. The message says how many this variant has.
Wrong#
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn square(): Shape = Rect(2.0)Fixed#
enum Shape { Circle(r: float), Rect(w: float, h: float) }
fn square(): Shape = Rect(2.0, 2.0)Common causes#
- A field added to the variant but not to every place that builds it.
- A field-less variant called with
(): write justEof.