docs

You are reading the docs for v0.1.2. Nabi 0.1.2 is no longer supported. Latest release: v0.1.3 →

#E0083: invalid enum value

A value enum (V = n) has only value variants, each with a distinct constant that fits the tag type. Fix the variants the message names.

nabi
enum Code { Ok = 0, Bad = 0 }
error[E0083]: `Code::Bad` and `Code::Ok` have the same value 0
  --> main.nabi:1:1
   |
 1 | enum Code { Ok = 0, Bad = 0 }
   | ^^^^

Give each variant its own value:

nabi
enum Code { Ok = 0, Bad = 1 }
println(f"{Code::Bad as i32}");
1

Related: E0094 invalid representation

Found a mistake? Edit this page on GitHub. Last updated