]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_errors/src/diagnostic.rs
Rollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholk
[rust.git] / compiler / rustc_errors / src / diagnostic.rs
index 0f79bc558bf26a824d6532bcb3768a6717429fbd..585a54308c62e1c0bf07ab9c1478bd51ec0fca2c 100644 (file)
@@ -370,7 +370,11 @@ pub fn replace_span_with(&mut self, after: Span) -> &mut Self {
         self.set_span(after);
         for span_label in before.span_labels() {
             if let Some(label) = span_label.label {
-                self.span.push_span_label(after, label);
+                if span_label.is_primary {
+                    self.span.push_span_label(after, label);
+                } else {
+                    self.span.push_span_label(span_label.span, label);
+                }
             }
         }
         self