rust/compiler/rustc_typeck
Guillaume Gomez 3b1e7b1fc9
Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726
Show discriminant before overflow in diagnostic for duplicate values.

This PR adds the value before overflow for explicit discriminant values in the error for duplicate discriminant values.
I found it rather confusing to see only the overflowed value.

It only does this for literals, since overflows in const evaluated arithmetic are already a hard error.

This is my first PR to the compiler, so please let me know if the implementation can be improved :)

Before:
![image](https://user-images.githubusercontent.com/786213/125850097-bf5fb7e0-d800-4386-a738-c30f41822964.png)

After:
![image](https://user-images.githubusercontent.com/786213/125850120-e2bb765d-ad86-4888-a6cb-dec34fba3fea.png)
2021-08-22 20:52:51 +02:00
..
src Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726 2021-08-22 20:52:51 +02:00
Cargo.toml rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
README.md

For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.