]> 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 06bb5edc090f48c8b6c326961982ce9730aa6957..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
@@ -802,7 +806,7 @@ pub fn multipart_suggestions(
         debug_assert!(
             !(suggestions
                 .iter()
-                .flat_map(|suggs| suggs)
+                .flatten()
                 .any(|(sp, suggestion)| sp.is_empty() && suggestion.is_empty())),
             "Span must not be empty and have no suggestion"
         );