Saltar al contenido
TE122 · Tipos · error

Dos flags ocupan el mismo bit

Dos flags de un solo bit en el mismo enum `@flags` resolvieron al mismo bit, normalmente porque recibieron el mismo valor explícito.

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

Véase también

Buscar en Zolo

9 resultados

en