rust/compiler
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
..
rustc rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_apfloat rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_arena rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_ast Remove box syntax from rustc_ast 2021-08-18 09:25:26 +02:00
rustc_ast_lowering Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
rustc_ast_passes Auto merge of #86860 - fee1-dead:stabilize, r=LeSeulArtichaut 2021-08-18 01:00:17 +00:00
rustc_ast_pretty Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
rustc_attr rustc: Fill out remaining parts of C-unwind ABI 2021-08-03 07:06:19 -07:00
rustc_builtin_macros Remove box syntax from rustc_builtin_macros 2021-08-18 09:25:26 +02:00
rustc_codegen_cranelift Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakis 2021-08-21 21:14:07 +00:00
rustc_codegen_llvm Auto merge of #87570 - nikic:llvm-13, r=nagisa 2021-08-21 09:25:28 +00:00
rustc_codegen_ssa Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakis 2021-08-21 21:14:07 +00:00
rustc_data_structures Remove duplicate trait bounds in rustc_data_structures::graph 2021-08-09 08:52:04 -05:00
rustc_driver Reduce verbosity of RUSTC_LOG 2021-08-09 21:39:39 -04:00
rustc_error_codes Auto merge of #88134 - rylev:force-warn-improvements, r=nikomatsakis 2021-08-21 15:51:50 +00:00
rustc_errors Modify structured suggestion output 2021-08-11 09:46:24 +00:00
rustc_expand Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
rustc_feature Auto merge of #87570 - nikic:llvm-13, r=nagisa 2021-08-21 09:25:28 +00:00
rustc_fs_util rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_graphviz rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_hir Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
rustc_hir_pretty Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
rustc_incremental rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_index rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_infer move fallback_if_possible and friends to fallback.rs 2021-08-20 17:27:50 -04:00
rustc_interface Replace #[plugin_registrar] with exporting __rustc_plugin_registrar 2021-08-10 14:20:48 +02:00
rustc_lexer Renamed variable str -> tail for clarity 2021-08-11 13:57:28 +02:00
rustc_lint Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez 2021-08-22 20:52:50 +02:00
rustc_lint_defs Auto merge of #87324 - asquared31415:named-asm-labels, r=Amanieu 2021-08-14 17:33:38 +00:00
rustc_llvm Handle SrcMgr diagnostics 2021-08-16 18:28:17 +02:00
rustc_macros Rollup merge of #86123 - Aaron1011:query-span, r=cjgillot 2021-08-19 19:30:04 +02:00
rustc_metadata Include (potentially remapped) working dir in crate hash 2021-08-15 15:17:37 -05:00
rustc_middle Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakis 2021-08-21 21:14:07 +00:00
rustc_mir Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakis 2021-08-21 21:14:07 +00:00
rustc_mir_build Auto merge of #88039 - sexxi-goose:fix-87987, r=nikomatsakis 2021-08-20 02:19:58 +00:00
rustc_parse Remove box syntax from rustc_parse 2021-08-18 09:25:26 +02:00
rustc_parse_format rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_passes Rollup merge of #88036 - nbdd0121:const3, r=petrochenkov 2021-08-18 19:54:59 +02:00
rustc_plugin_impl Replace #[plugin_registrar] with exporting __rustc_plugin_registrar 2021-08-10 14:20:48 +02:00
rustc_privacy rustc_privacy: Replace HirIds and DefIds with LocalDefIds where possible 2021-08-19 00:01:12 +03:00
rustc_query_impl Fold vtable_trait_upcasting_coercion_new_vptr_slot logic into obligation processing. 2021-08-18 13:00:27 +08:00
rustc_query_system Prevent double panic when handling incremental fingerprint mismatch 2021-08-12 15:11:39 -05:00
rustc_resolve review comment: use newtype to deduplicate logic 2021-08-18 14:05:15 +00:00
rustc_save_analysis Include (potentially remapped) working dir in crate hash 2021-08-15 15:17:37 -05:00
rustc_serialize Remove box syntax from rustc_serialize 2021-08-18 09:25:26 +02:00
rustc_session Include (potentially remapped) working dir in crate hash 2021-08-15 15:17:37 -05:00
rustc_span Rollup merge of #88050 - Aaron1011:filename-hash-stable, r=michaelwoerister 2021-08-19 19:30:07 +02:00
rustc_symbol_mangling Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkov 2021-08-12 04:30:41 +00:00
rustc_target Auto merge of #87570 - nikic:llvm-13, r=nagisa 2021-08-21 09:25:28 +00:00
rustc_trait_selection Auto merge of #88139 - lcnr:marker-trait-attr, r=nikomatsakis 2021-08-22 10:44:38 +00:00
rustc_traits introduce a Coerce predicate 2021-08-19 17:28:24 -04:00
rustc_ty_utils Fold vtable_trait_upcasting_coercion_new_vptr_slot logic into obligation processing. 2021-08-18 13:00:27 +08:00
rustc_type_ir rfc3052: Remove authors field from Cargo manifests 2021-07-29 14:56:05 -07:00
rustc_typeck Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726 2021-08-22 20:52:51 +02:00