blob: c05324a5a2ccbc5c472634cfceb8a4567821c9ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
A constant value failed to get evaluated.
Erroneous code example:
```compile_fail,E0080
enum Enum {
X = (1 << 500),
Y = (1 / 0),
}
```
This error indicates that the compiler was unable to sensibly evaluate a
constant expression that had to be evaluated. Attempting to divide by 0
or causing an integer overflow are two ways to induce this error.
Ensure that the expressions given can be evaluated as the desired integer type.
See the [Discriminants] section of the Reference for more information about
setting custom integer types on enums using the
[`repr` attribute][repr-attribute].
[discriminants]: https://doc.rust-lang.org/reference/items/enumerations.html#discriminants
[repr-attribute]: https://doc.rust-lang.org/reference/type-layout.html#representations
|