about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-02 07:30:23 +0000
committerbors <bors@rust-lang.org>2023-01-02 07:30:23 +0000
commitd5a7ddd99f5e43116ec452777f08fddbde7f42fd (patch)
tree3061e2a9858a21c04f33f95129da18893295cdcc /compiler/rustc_errors/src
parentc5cb156caa27655bc8dcf135de4d026ac4b25a4a (diff)
parent545406528a229f24844305b1a925cd6c743ea8ed (diff)
downloadrust-d5a7ddd99f5e43116ec452777f08fddbde7f42fd.tar.gz
rust-d5a7ddd99f5e43116ec452777f08fddbde7f42fd.zip
Auto merge of #106284 - estebank:merge-mut-errors, r=jyn514
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);