From 5bfcfeee2ac9da6a69bf62a58db3e5f80ee0a823 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Thu, 29 Dec 2022 22:46:17 -0800 Subject: Merge multiple mutable borrows of immutable binding errors Fix #53466. --- compiler/rustc_errors/src/diagnostic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 585a54308c6..e19a6fe0ee9 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -365,12 +365,12 @@ impl Diagnostic { self } - pub fn replace_span_with(&mut self, after: Span) -> &mut Self { + pub fn replace_span_with(&mut self, after: Span, keep_label: bool) -> &mut Self { let before = self.span.clone(); self.set_span(after); for span_label in before.span_labels() { if let Some(label) = span_label.label { - if span_label.is_primary { + if span_label.is_primary && keep_label { self.span.push_span_label(after, label); } else { self.span.push_span_label(span_label.span, label); -- cgit 1.4.1-3-g733a5