about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-15 07:16:49 +0200
committerGitHub <noreply@github.com>2024-05-15 07:16:49 +0200
commit5f1a120ee5b5dfda12c557cd66853ee93e00232b (patch)
treeae05395b8a88ed41b9f129a6ca76daa5184948bf /compiler/rustc_errors/src
parentf7c293442074ec4ef5d5114700c37ad62ecf0834 (diff)
parent75895f59b0742126a7b5abeb86b35df2dfa8ee59 (diff)
downloadrust-5f1a120ee5b5dfda12c557cd66853ee93e00232b.tar.gz
rust-5f1a120ee5b5dfda12c557cd66853ee93e00232b.zip
Rollup merge of #125135 - chenyukang:yukang-fix-116502, r=compiler-errors
Fix the dedup error because of spans from suggestion

Fixes #116502

I believe this kind of issue is supposed resolved by #118057, but the `==` in `span` respect syntax context, here we should only care that they point to the same bytes of source text, so should use `source_equal`.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 1610135a0ef..18bb71bd99f 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -896,7 +896,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
         style: SuggestionStyle,
     ) -> &mut Self {
         suggestion.sort_unstable();
-        suggestion.dedup();
+        suggestion.dedup_by(|(s1, m1), (s2, m2)| s1.source_equal(*s2) && m1 == m2);
 
         let parts = suggestion
             .into_iter()