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¶
TE120— a flag value isn't a power of two or a known composite.TE121— a flag value doesn't fit the backing type.- /docs/data-structures#enums —
@flagsbit-flag enums.