E0731 - Error codes index
Description: Book listing all Rust error codes

## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

# Error code E0731

An enum with the representation hint `repr(transparent)` had zero or more than one variants.

Erroneous code example:

    #![allow(unused)]
    fn main() {
    #[repr(transparent)]
    enum Status { // error: transparent enum needs exactly one variant, but has 2
        Errno(u32),
        Ok,
    }
    }

Because transparent enums are represented exactly like one of their variants at run time, said variant must be uniquely determined. If there is no variant, or if there are multiple variants, it is not clear how the enum should be represented.