E0117
Variant without its enum
ErrorSafe fixA variant is named through its enum: Expr.Num(2) and State.Idle, not Num(2) or Idle. This error fires when no function, class, constant or binding takes the name, but an enum has a variant of it.
Why
A variant lives inside its enum, so two enums can each have an Idle, and a class or function can take the name Num beside a variant Expr.Num. Writing the enum's name says which one you mean. When exactly one enum has the variant, the fix inserts its name; when several do, you choose.
Broken
enum Expr {
Num(i64)
}
fn main() {
let _ = Num(2)
}
What sisu says
error[E0117]: `Num` is a variant of `Expr`; write `Expr.Num` --> E0117.sisu:6:13 | 6 | let _ = Num(2) | ^^^ | help: write `Expr.Num` | 6 | let _ = Expr.Num(2) | +++++ sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0117
Fixed
enum Expr {
Num(i64)
}
fn main() {
let _ = Expr.Num(2)
}
Sisu