Skip to content
TE122 · Type · error

Two flags occupy the same bit

Two single-bit flags in the same `@flags` enum resolved to the same bit, usually because both were given the same explicit value.

Why this fires

Two single-bit flags in the same @flags enum resolved to the same bit — usually because both were given the same explicit value.

@flags
enum Perm: u8 {
    Read  = 1,
    Write = 1,
    //      ^ error[TE122]: flags `Perm::Read` and `Perm::Write` occupy the same bit 1
}

Fix it

Give each single-bit flag a distinct power of two, or drop the explicit values and let them auto-increment:

@flags
enum Perm: u8 {
    Read,                     // 1
    Write,                    // 2
}

See also

See also

Search Zolo

9 results

en