Error code E0559

An unknown field was specified into an enum’s structure variant.

Erroneous code example:

enum Field {
    Fool { x: u32 },
}

let s = Field::Fool { joke: 0 };
// error: struct variant `Field::Fool` has no field named `joke`
Run

Verify you didn’t misspell the field’s name or that the field exists. Example:

enum Field {
    Fool { joke: u32 },
}

let s = Field::Fool { joke: 0 }; // ok!
Run

Back to list of error codes