E1041: wrong number of values for an enum variant

View source

A variant with a payload must be built with exactly one value for each payload field, and a unit variant takes none.

A variant with a payload must be built with exactly one value for each payload field, and a unit variant takes none. The same rule applies to the sub-patterns of a case branch. The message gives the expected and the found count. In a pattern it names the enum and variant the pattern spells. The error points at the constructor or the pattern.

Example

actus
enum Shape {
    Circle(u32),
}

verb main() {
    erg s: Shape = Shape.Circle(1u32, 2u32);
}

Fix

Pass one value for each payload field.

actus
enum Shape {
    Circle(u32),
}

verb main() {
    erg s: Shape = Shape.Circle(1u32);
}

Run actus explain E1041 in your terminal to read this entry offline. Browse Ownership & types or all error codes.