about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2022-12-29 22:46:17 -0800
committerEsteban Küber <esteban@kuber.com.ar>2023-01-01 10:09:26 -0800
commit5bfcfeee2ac9da6a69bf62a58db3e5f80ee0a823 (patch)
tree62afefb89c89103316349f851ea27d2adaff3cff /compiler/rustc_errors/src
parentbb6e76df06dcbdb96e634eb28a49f161d70ab844 (diff)
downloadrust-5bfcfeee2ac9da6a69bf62a58db3e5f80ee0a823.tar.gz
rust-5bfcfeee2ac9da6a69bf62a58db3e5f80ee0a823.zip
Merge multiple mutable borrows of immutable binding errors
Fix #53466.
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs4
1 files changed, 2 insertions, 2 deletions
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);