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