diff options
Diffstat (limited to 'compiler/rustc_error_codes/src/error_codes/E0080.md')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0080.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0080.md b/compiler/rustc_error_codes/src/error_codes/E0080.md new file mode 100644 index 000000000..7b1bbde61 --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0080.md @@ -0,0 +1,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 [Custom Discriminants][custom-discriminants] section of the Reference +for more information about setting custom integer types on fieldless enums +using the [`repr` attribute][repr-attribute]. + +[custom-discriminants]: https://doc.rust-lang.org/reference/items/enumerations.html#custom-discriminant-values-for-field-less-enumerations +[repr-attribute]: https://doc.rust-lang.org/reference/type-layout.html#reprc-enums |