File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -1193,12 +1193,32 @@ discriminant values so that they fit within the existing type.
11931193"## ,
11941194
11951195E0084 : r##"
1196+ An unsupported representation was attempted on a zero-variant enum.
1197+
1198+ Erroneous code example:
1199+
1200+ ```compile_fail
1201+ #[repr(i32)]
1202+ enum NightWatch {} // error: unsupported representation for zero-variant enum
1203+ ```
1204+
11961205It is impossible to define an integer type to be used to represent zero-variant
11971206enum values because there are no zero-variant enum values. There is no way to
1198- construct an instance of the following type using only safe code:
1207+ construct an instance of the following type using only safe code. So you have
1208+ two solutions. Either you add variants in your enum:
1209+
1210+ ```
1211+ #[repr(i32)]
1212+ enum NightWatch {
1213+ JohnSnow,
1214+ Commander,
1215+ }
1216+ ```
1217+
1218+ or you remove the integer represention of your enum:
11991219
12001220```
1201- enum Empty {}
1221+ enum NightWatch {}
12021222```
12031223"## ,
12041224
You can’t perform that action at this time.
0 commit comments