diff options
| author | Gurinder Singh <frederick.the.fool@gmail.com> | 2023-10-19 08:03:40 +0530 |
|---|---|---|
| committer | Gurinder Singh <frederick.the.fool@gmail.com> | 2023-10-19 08:03:40 +0530 |
| commit | 0091166b5767c45152318abcf7b9c97cc268e1b3 (patch) | |
| tree | 724d2bbab1652e2de9f5d50c43e32364b11ba282 /compiler/rustc_errors/src | |
| parent | 9ace9da2e050ff30f07a30323e5b3b3fcb63cd8f (diff) | |
| download | rust-0091166b5767c45152318abcf7b9c97cc268e1b3.tar.gz rust-0091166b5767c45152318abcf7b9c97cc268e1b3.zip | |
Fix duplicate labels emitted in `render_multispan_macro_backtrace()`
Using hash set instead of vec to weed out duplicates
Diffstat (limited to 'compiler/rustc_errors/src')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 922846775f6..d3ce3617dd6 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -23,7 +23,7 @@ use crate::{ use rustc_lint_defs::pluralize; use derive_setters::Setters; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap}; +use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; use rustc_data_structures::sync::{DynSend, IntoDynSyncSend, Lrc}; use rustc_error_messages::{FluentArgs, SpanLabel}; use rustc_span::hygiene::{ExpnKind, MacroKind}; @@ -370,7 +370,7 @@ pub trait Emitter: Translate { } fn render_multispan_macro_backtrace(&self, span: &mut MultiSpan, always_backtrace: bool) { - let mut new_labels: Vec<(Span, String)> = vec![]; + let mut new_labels = FxIndexSet::default(); for &sp in span.primary_spans() { if sp.is_dummy() { @@ -387,7 +387,7 @@ pub trait Emitter: Translate { } if always_backtrace { - new_labels.push(( + new_labels.insert(( trace.def_site, format!( "in this expansion of `{}`{}", @@ -431,7 +431,7 @@ pub trait Emitter: Translate { format!("this {} desugaring", kind.descr()).into() } }; - new_labels.push(( + new_labels.insert(( trace.call_site, format!( "in {}{}", |
