E0419: Duplicate variant
| Code | Category | Stability |
|---|---|---|
E0419 | Struct and enum | Permanent |
Explanation
An enum declaration defines the same variant name more than once. Variant names identify the alternatives of one enum and must be unique within that enum.
Likely cause
A variant was copied, generated twice, or renamed to a name already used in the same enum. Remove the duplicate or give every variant in the enum a distinct name; another enum may independently use the same variant name.
Examples
Duplicate variant name
enum Color { Red, Green, Red }
fn main() -> i32 { 0 }
Use unique variant names
enum Color { Red, Green, Blue }
fn main() -> i32 {
let color = Color.Blue;
0
}