]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0731.md
Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebank
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0731.md
1 An enum with the representation hint `repr(transparent)` had zero or more than
2 one variants.
3
4 Erroneous code example:
5
6 ```compile_fail,E0731
7 #[repr(transparent)]
8 enum Status { // error: transparent enum needs exactly one variant, but has 2
9     Errno(u32),
10     Ok,
11 }
12 ```
13
14 Because transparent enums are represented exactly like one of their variants at
15 run time, said variant must be uniquely determined. If there is no variant, or
16 if there are multiple variants, it is not clear how the enum should be
17 represented.