about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-13 00:29:28 +0000
committerbors <bors@rust-lang.org>2022-12-13 00:29:28 +0000
commitb96d9e0e20adb7716aa32a56fe96fde15c75d517 (patch)
tree454f2841806010e5903bce4628eedcc1af27f35c /compiler/rustc_errors/src
parented9749324aed9e97741abf569a022353e269a9df (diff)
parent5af04471aacadf650c23eed54b70fbe04e2230c2 (diff)
downloadrust-b96d9e0e20adb7716aa32a56fe96fde15c75d517.tar.gz
rust-b96d9e0e20adb7716aa32a56fe96fde15c75d517.zip
Auto merge of #105644 - matthiaskrgr:rollup-qc6hlzq, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104864 (Account for item-local in inner scope for E0425)
 - #105332 (Point out the type of associated types in every method call of iterator chains)
 - #105620 (Remove unnecessary uses of `clone`)
 - #105625 (minor code cleanups)
 - #105629 (rustdoc: stop treating everything in a trait item as a method)
 - #105636 (Add check for local-storage value when changing "display line numbers" settings)
 - #105639 (rustdoc: remove `type="text/css" from stylesheet links)
 - #105640 (Adjust miri to still be optional)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_errors/src')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs8
-rw-r--r--compiler/rustc_errors/src/emitter.rs4
2 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 06bb5edc090..585a54308c6 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -370,7 +370,11 @@ impl Diagnostic {
         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 @@ impl Diagnostic {
         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"
         );
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 4df2198fb0e..aaf0699f0dc 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1308,7 +1308,7 @@ impl EmitterWriter {
         //                see how it *looks* with
         //                very *weird* formats
         //                see?
-        for &(ref text, ref style) in msg.iter() {
+        for (text, style) in msg.iter() {
             let text = self.translate_message(text, args);
             let lines = text.split('\n').collect::<Vec<_>>();
             if lines.len() > 1 {
@@ -1370,7 +1370,7 @@ impl EmitterWriter {
                 buffer.append(0, ": ", header_style);
                 label_width += 2;
             }
-            for &(ref text, _) in msg.iter() {
+            for (text, _) in msg.iter() {
                 let text = self.translate_message(text, args);
                 // Account for newlines to align output to its label.
                 for (line, text) in normalize_whitespace(&text).lines().enumerate() {