about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_errors/src/emitter.rs81
-rw-r--r--src/test/ui/closures/closure-expected.stderr3
-rw-r--r--src/test/ui/closures/closure-move-sync.stderr8
-rw-r--r--src/test/ui/closures/coerce-unsafe-to-closure.stderr3
-rw-r--r--src/test/ui/error-codes/E0004-2.stderr8
-rw-r--r--src/test/ui/error-codes/E0005.stderr4
-rw-r--r--src/test/ui/error-codes/E0297.stderr4
-rw-r--r--src/test/ui/expr/malformed_closure/ruby_style_closure.stderr3
-rw-r--r--src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr4
-rw-r--r--src/test/ui/inference/issue-71732.stderr3
-rw-r--r--src/test/ui/intrinsics/const-eval-select-bad.stderr16
-rw-r--r--src/test/ui/issues/issue-20162.stderr2
-rw-r--r--src/test/ui/issues/issue-23966.stderr3
-rw-r--r--src/test/ui/issues/issue-31173.stderr3
-rw-r--r--src/test/ui/issues/issue-33941.stderr3
-rw-r--r--src/test/ui/issues/issue-34334.stderr2
-rw-r--r--src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr4
-rw-r--r--src/test/ui/iterators/collect-into-array.stderr2
-rw-r--r--src/test/ui/iterators/collect-into-slice.stderr4
-rw-r--r--src/test/ui/iterators/invalid-iterator-chain.stderr17
-rw-r--r--src/test/ui/lazy-type-alias-impl-trait/branches.stderr2
-rw-r--r--src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr4
-rw-r--r--src/test/ui/mismatched_types/closure-arg-count.stderr12
-rw-r--r--src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr9
-rw-r--r--src/test/ui/mismatched_types/issue-36053-2.stderr3
-rw-r--r--src/test/ui/mismatched_types/issue-47706-trait.stderr3
-rw-r--r--src/test/ui/mismatched_types/issue-47706.stderr3
-rw-r--r--src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr2
-rw-r--r--src/test/ui/no-send-res-ports.stderr4
-rw-r--r--src/test/ui/on-unimplemented/sum.stderr6
-rw-r--r--src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr4
-rw-r--r--src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr4
-rw-r--r--src/test/ui/pattern/usefulness/issue-3601.stderr3
-rw-r--r--src/test/ui/pattern/usefulness/match-arm-statics-2.stderr7
-rw-r--r--src/test/ui/pattern/usefulness/match-privately-empty.stderr4
-rw-r--r--src/test/ui/pattern/usefulness/non-exhaustive-match.stderr4
-rw-r--r--src/test/ui/proc-macro/signature.stderr4
-rw-r--r--src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr4
-rw-r--r--src/test/ui/str/str-mut-idx.stderr3
-rw-r--r--src/test/ui/traits/issue-77982.stderr3
-rw-r--r--src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr12
-rw-r--r--src/test/ui/unique-object-noncopyable.stderr6
-rw-r--r--src/test/ui/unique-pinned-nocopy.stderr6
43 files changed, 94 insertions, 195 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 268f17f86fe..c62e358e804 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1408,51 +1408,58 @@ impl EmitterWriter {
             if !sm.ensure_source_file_source_present(annotated_file.file.clone()) {
                 if !self.short_message {
                     // We'll just print an unannotated message.
-                    for (annotation_id, line) in annotated_file.lines.into_iter().enumerate() {
+                    for (annotation_id, line) in annotated_file.lines.iter().enumerate() {
                         let mut annotations = line.annotations.clone();
                         annotations.sort_by_key(|a| Reverse(a.start_col));
                         let mut line_idx = buffer.num_lines();
-                        buffer.append(
-                            line_idx,
-                            &format!(
-                                "{}:{}:{}",
-                                sm.filename_for_diagnostics(&annotated_file.file.name),
-                                sm.doctest_offset_line(&annotated_file.file.name, line.line_index),
-                                annotations[0].start_col + 1,
-                            ),
-                            Style::LineAndColumn,
-                        );
-                        if annotation_id == 0 {
-                            buffer.prepend(line_idx, "--> ", Style::LineNumber);
+
+                        let labels: Vec<_> = annotations
+                            .iter()
+                            .filter_map(|a| Some((a.label.as_ref()?, a.is_primary)))
+                            .filter(|(l, _)| !l.is_empty())
+                            .collect();
+
+                        if annotation_id == 0 || !labels.is_empty() {
+                            buffer.append(
+                                line_idx,
+                                &format!(
+                                    "{}:{}:{}",
+                                    sm.filename_for_diagnostics(&annotated_file.file.name),
+                                    sm.doctest_offset_line(
+                                        &annotated_file.file.name,
+                                        line.line_index
+                                    ),
+                                    annotations[0].start_col + 1,
+                                ),
+                                Style::LineAndColumn,
+                            );
+                            if annotation_id == 0 {
+                                buffer.prepend(line_idx, "--> ", Style::LineNumber);
+                            } else {
+                                buffer.prepend(line_idx, "::: ", Style::LineNumber);
+                            }
                             for _ in 0..max_line_num_len {
                                 buffer.prepend(line_idx, " ", Style::NoStyle);
                             }
                             line_idx += 1;
-                        };
-                        for (i, annotation) in annotations.into_iter().enumerate() {
-                            if let Some(label) = &annotation.label {
-                                if !label.is_empty() {
-                                    let style = if annotation.is_primary {
-                                        Style::LabelPrimary
-                                    } else {
-                                        Style::LabelSecondary
-                                    };
-                                    if annotation_id == 0 {
-                                        buffer.prepend(line_idx, " |", Style::LineNumber);
-                                        for _ in 0..max_line_num_len {
-                                            buffer.prepend(line_idx, " ", Style::NoStyle);
-                                        }
-                                        line_idx += 1;
-                                        buffer.append(line_idx + i, " = note: ", style);
-                                        for _ in 0..max_line_num_len {
-                                            buffer.prepend(line_idx, " ", Style::NoStyle);
-                                        }
-                                    } else {
-                                        buffer.append(line_idx + i, ": ", style);
-                                    }
-                                    buffer.append(line_idx + i, label, style);
-                                }
+                        }
+                        for (label, is_primary) in labels.into_iter() {
+                            let style = if is_primary {
+                                Style::LabelPrimary
+                            } else {
+                                Style::LabelSecondary
+                            };
+                            buffer.prepend(line_idx, " |", Style::LineNumber);
+                            for _ in 0..max_line_num_len {
+                                buffer.prepend(line_idx, " ", Style::NoStyle);
+                            }
+                            line_idx += 1;
+                            buffer.append(line_idx, " = note: ", style);
+                            for _ in 0..max_line_num_len {
+                                buffer.prepend(line_idx, " ", Style::NoStyle);
                             }
+                            buffer.append(line_idx, label, style);
+                            line_idx += 1;
                         }
                     }
                 }
diff --git a/src/test/ui/closures/closure-expected.stderr b/src/test/ui/closures/closure-expected.stderr
index 8671f4048ce..87a5d67a420 100644
--- a/src/test/ui/closures/closure-expected.stderr
+++ b/src/test/ui/closures/closure-expected.stderr
@@ -10,9 +10,6 @@ LL |     let y = x.or_else(4);
    = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
 note: required by a bound in `Option::<T>::or_else`
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr
index 3dc761a6303..64e3b51ea71 100644
--- a/src/test/ui/closures/closure-move-sync.stderr
+++ b/src/test/ui/closures/closure-move-sync.stderr
@@ -19,10 +19,6 @@ LL |     let t = thread::spawn(|| {
    |                           ^^
 note: required by a bound in `spawn`
   --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
 
 error[E0277]: `Sender<()>` cannot be shared between threads safely
   --> $DIR/closure-move-sync.rs:18:19
@@ -41,10 +37,6 @@ LL |     thread::spawn(|| tx.send(()).unwrap());
    |                   ^^
 note: required by a bound in `spawn`
   --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/closures/coerce-unsafe-to-closure.stderr b/src/test/ui/closures/coerce-unsafe-to-closure.stderr
index 7144a18aea2..449cd0b3177 100644
--- a/src/test/ui/closures/coerce-unsafe-to-closure.stderr
+++ b/src/test/ui/closures/coerce-unsafe-to-closure.stderr
@@ -10,9 +10,6 @@ LL |     let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
    = note: unsafe function cannot be called generically without an unsafe block
 note: required by a bound in `Option::<T>::map`
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr
index 7dd1396529b..e829bac196f 100644
--- a/src/test/ui/error-codes/E0004-2.stderr
+++ b/src/test/ui/error-codes/E0004-2.stderr
@@ -6,8 +6,12 @@ LL |     match x { }
    |
 note: `Option<i32>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<i32>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
    |
diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr
index ef1bb60d149..0f179259356 100644
--- a/src/test/ui/error-codes/E0005.stderr
+++ b/src/test/ui/error-codes/E0005.stderr
@@ -8,7 +8,9 @@ LL |     let Some(y) = x;
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
 note: `Option<i32>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<i32>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr
index 5afa25dcb72..903422f3b9b 100644
--- a/src/test/ui/error-codes/E0297.stderr
+++ b/src/test/ui/error-codes/E0297.stderr
@@ -6,7 +6,9 @@ LL |     for Some(x) in xs {}
    |
 note: `Option<i32>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<i32>`
 
 error: aborting due to previous error
diff --git a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
index 88909cc5c63..2f9d10d70a2 100644
--- a/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
+++ b/src/test/ui/expr/malformed_closure/ruby_style_closure.stderr
@@ -22,9 +22,6 @@ LL | |     });
    = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
 note: required by a bound in `Option::<T>::and_then`
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
index b26383af72f..e253e4791e8 100644
--- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
+++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
@@ -8,7 +8,9 @@ LL |     let Ok(_x) = foo();
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
 note: `Result<u32, !>` defined here
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Result<u32, !>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
diff --git a/src/test/ui/inference/issue-71732.stderr b/src/test/ui/inference/issue-71732.stderr
index 22bbfa479f6..01b37f2acaa 100644
--- a/src/test/ui/inference/issue-71732.stderr
+++ b/src/test/ui/inference/issue-71732.stderr
@@ -12,9 +12,6 @@ LL |         .get(&"key".into())
              where T: ?Sized;
 note: required by a bound in `HashMap::<K, V, S>::get`
   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
 help: consider specifying the generic argument
    |
 LL |         .get::<Q>(&"key".into())
diff --git a/src/test/ui/intrinsics/const-eval-select-bad.stderr b/src/test/ui/intrinsics/const-eval-select-bad.stderr
index 565e740ec37..fd7d061b6b2 100644
--- a/src/test/ui/intrinsics/const-eval-select-bad.stderr
+++ b/src/test/ui/intrinsics/const-eval-select-bad.stderr
@@ -37,10 +37,6 @@ LL |     const_eval_select((), 42, 0xDEADBEEF);
    = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
 note: required by a bound in `const_eval_select`
   --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
 
 error: this argument must be a function item
   --> $DIR/const-eval-select-bad.rs:10:31
@@ -63,10 +59,6 @@ LL |     const_eval_select((), 42, 0xDEADBEEF);
    = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
 note: required by a bound in `const_eval_select`
   --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
 
 error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool`
   --> $DIR/const-eval-select-bad.rs:32:34
@@ -78,10 +70,6 @@ LL |     const_eval_select((1,), foo, bar);
    |
 note: required by a bound in `const_eval_select`
   --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
 
 error[E0631]: type mismatch in function arguments
   --> $DIR/const-eval-select-bad.rs:37:32
@@ -98,10 +86,6 @@ LL |     const_eval_select((true,), foo, baz);
               found function signature `fn(i32) -> _`
 note: required by a bound in `const_eval_select`
   --> $SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
-$SRC_DIR/core/src/intrinsics.rs:LL:COL
 
 error: this argument must be a `const fn`
   --> $DIR/const-eval-select-bad.rs:42:29
diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr
index 6f2709a482a..1c5b76fbfc1 100644
--- a/src/test/ui/issues/issue-20162.stderr
+++ b/src/test/ui/issues/issue-20162.stderr
@@ -6,8 +6,6 @@ LL |     b.sort();
    |
 note: required by a bound in `slice::<impl [T]>::sort`
   --> $SRC_DIR/alloc/src/slice.rs:LL:COL
-$SRC_DIR/alloc/src/slice.rs:LL:COL
-$SRC_DIR/alloc/src/slice.rs:LL:COL
 help: consider annotating `X` with `#[derive(Ord)]`
    |
 LL | #[derive(Ord)]
diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr
index c48d21eb3c4..8f934481d85 100644
--- a/src/test/ui/issues/issue-23966.stderr
+++ b/src/test/ui/issues/issue-23966.stderr
@@ -9,9 +9,6 @@ LL |     "".chars().fold(|_, _| (), ());
    = help: the trait `FnMut<(_, char)>` is not implemented for `()`
 note: required by a bound in `fold`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr
index b0dea3696b9..b667ae0a789 100644
--- a/src/test/ui/issues/issue-31173.stderr
+++ b/src/test/ui/issues/issue-31173.stderr
@@ -8,9 +8,6 @@ LL |         .cloned()
                    found type `u8`
 note: required by a bound in `cloned`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied
   --> $DIR/issue-31173.rs:12:10
diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr
index 13d4a43fa85..49702c47658 100644
--- a/src/test/ui/issues/issue-33941.stderr
+++ b/src/test/ui/issues/issue-33941.stderr
@@ -8,9 +8,6 @@ LL |     for _ in HashMap::new().iter().cloned() {}
                   found tuple `(&_, &_)`
 note: required by a bound in `cloned`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
   --> $DIR/issue-33941.rs:6:14
diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
index 2635b16f83c..9d2c315e4db 100644
--- a/src/test/ui/issues/issue-34334.stderr
+++ b/src/test/ui/issues/issue-34334.stderr
@@ -32,8 +32,6 @@ LL |     let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_rece
    |                                    `Iterator::Item` is `&(_, _, _)` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
index f9a73239f59..cec482a53ba 100644
--- a/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
+++ b/src/test/ui/issues/issue-66923-show-error-for-correct-call.stderr
@@ -15,8 +15,6 @@ LL |     let x2: Vec<f64> = x1.into_iter().collect();
    |                           ^^^^^^^^^^^ `Iterator::Item` is `&f64` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `Vec<f64>` cannot be built from an iterator over elements of type `&f64`
   --> $DIR/issue-66923-show-error-for-correct-call.rs:12:29
@@ -36,8 +34,6 @@ LL |     let x3 = x1.into_iter().collect::<Vec<f64>>();
    |                 ^^^^^^^^^^^ `Iterator::Item` is `&f64` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/iterators/collect-into-array.stderr b/src/test/ui/iterators/collect-into-array.stderr
index 0b2f8f6a149..e38745cc10e 100644
--- a/src/test/ui/iterators/collect-into-array.stderr
+++ b/src/test/ui/iterators/collect-into-array.stderr
@@ -7,8 +7,6 @@ LL |     let whatever: [u32; 10] = (0..10).collect();
    = help: the trait `FromIterator<{integer}>` is not implemented for `[u32; 10]`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/iterators/collect-into-slice.stderr b/src/test/ui/iterators/collect-into-slice.stderr
index b59a5e57775..29fff8c51c6 100644
--- a/src/test/ui/iterators/collect-into-slice.stderr
+++ b/src/test/ui/iterators/collect-into-slice.stderr
@@ -17,8 +17,6 @@ LL |     let some_generated_vec = (0..10).collect();
    = help: the trait `Sized` is not implemented for `[i32]`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a slice of type `[i32]` cannot be built since `[i32]` has no definite size
   --> $DIR/collect-into-slice.rs:6:38
@@ -29,8 +27,6 @@ LL |     let some_generated_vec = (0..10).collect();
    = help: the trait `FromIterator<{integer}>` is not implemented for `[i32]`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/iterators/invalid-iterator-chain.stderr b/src/test/ui/iterators/invalid-iterator-chain.stderr
index 27ce4a19b07..84bac7833f6 100644
--- a/src/test/ui/iterators/invalid-iterator-chain.stderr
+++ b/src/test/ui/iterators/invalid-iterator-chain.stderr
@@ -22,9 +22,6 @@ LL | |         });
    | |__________^ `Iterator::Item` changed to `()` here
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
   --> $DIR/invalid-iterator-chain.rs:18:14
@@ -57,9 +54,6 @@ LL |             .map(|x| { x; })
    |              ^^^^^^^^^^^^^^^ `Iterator::Item` changed to `()` here
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `f64`
   --> $DIR/invalid-iterator-chain.rs:28:14
@@ -88,9 +82,6 @@ LL |             .map(|x| { x + 1.0 })
    |              -------------------- `Iterator::Item` remains `f64` here
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `()`
   --> $DIR/invalid-iterator-chain.rs:30:54
@@ -112,9 +103,6 @@ LL |     println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::<i32>());
    |                    this expression has type `Vec<{integer}>`
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `i32` cannot be made by summing an iterator over elements of type `&()`
   --> $DIR/invalid-iterator-chain.rs:31:40
@@ -135,9 +123,6 @@ LL |     println!("{}", vec![(), ()].iter().sum::<i32>());
    |                    this expression has type `Vec<()>`
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `Vec<i32>` cannot be built from an iterator over elements of type `()`
   --> $DIR/invalid-iterator-chain.rs:40:25
@@ -167,8 +152,6 @@ LL |       let f = e.filter(|_| false);
    |                 ----------------- `Iterator::Item` remains `()` here
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 6 previous errors
 
diff --git a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr
index 2b7213450ed..0b206f31e7b 100644
--- a/src/test/ui/lazy-type-alias-impl-trait/branches.stderr
+++ b/src/test/ui/lazy-type-alias-impl-trait/branches.stderr
@@ -7,8 +7,6 @@ LL |         std::iter::empty().collect()
    = help: the trait `FromIterator<_>` is not implemented for `Bar`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr
index 5c84a2570d8..d8ac39a4f27 100644
--- a/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr
+++ b/src/test/ui/lazy-type-alias-impl-trait/recursion4.stderr
@@ -7,8 +7,6 @@ LL |     x = std::iter::empty().collect();
    = help: the trait `FromIterator<_>` is not implemented for `Foo`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `impl Debug` cannot be built from an iterator over elements of type `_`
   --> $DIR/recursion4.rs:19:28
@@ -19,8 +17,6 @@ LL |     x = std::iter::empty().collect();
    = help: the trait `FromIterator<_>` is not implemented for `impl Debug`
 note: required by a bound in `collect`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr
index b7d29151d6c..2ecab9f024a 100644
--- a/src/test/ui/mismatched_types/closure-arg-count.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-count.stderr
@@ -128,9 +128,6 @@ LL | fn foo() {}
    |
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
   --> $DIR/closure-arg-count.rs:27:57
@@ -144,9 +141,6 @@ LL |     let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
    |
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments
   --> $DIR/closure-arg-count.rs:29:57
@@ -161,9 +155,6 @@ LL | fn qux(x: usize, y: usize) {}
    |
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
   --> $DIR/closure-arg-count.rs:32:45
@@ -175,9 +166,6 @@ LL |     let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
    |
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
   --> $DIR/closure-arg-count.rs:35:10
diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
index 596b1fe046d..ebff0c19e2b 100644
--- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
@@ -10,9 +10,6 @@ LL |     a.iter().map(|_: (u32, u32)| 45);
               found closure signature `fn((u32, u32)) -> _`
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:4:14
@@ -26,9 +23,6 @@ LL |     a.iter().map(|_: &(u16, u16)| 45);
               found closure signature `for<'a> fn(&'a (u16, u16)) -> _`
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0631]: type mismatch in closure arguments
   --> $DIR/closure-arg-type-mismatch.rs:5:14
@@ -42,9 +36,6 @@ LL |     a.iter().map(|_: (u16, u16)| 45);
               found closure signature `fn((u16, u16)) -> _`
 note: required by a bound in `map`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr
index c944b13224f..4afe0e6a664 100644
--- a/src/test/ui/mismatched_types/issue-36053-2.stderr
+++ b/src/test/ui/mismatched_types/issue-36053-2.stderr
@@ -10,9 +10,6 @@ LL |     once::<&str>("str").fuse().filter(|a: &str| true).count();
               found closure signature `for<'a> fn(&'a str) -> _`
 note: required by a bound in `filter`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>`, but its trait bounds were not satisfied
   --> $DIR/issue-36053-2.rs:7:55
diff --git a/src/test/ui/mismatched_types/issue-47706-trait.stderr b/src/test/ui/mismatched_types/issue-47706-trait.stderr
index 9e8d4c6dec7..a5f38dd5366 100644
--- a/src/test/ui/mismatched_types/issue-47706-trait.stderr
+++ b/src/test/ui/mismatched_types/issue-47706-trait.stderr
@@ -10,9 +10,6 @@ LL |         None::<()>.map(Self::f);
    |
 note: required by a bound in `Option::<T>::map`
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/mismatched_types/issue-47706.stderr b/src/test/ui/mismatched_types/issue-47706.stderr
index c4185d732fe..d9d408844d0 100644
--- a/src/test/ui/mismatched_types/issue-47706.stderr
+++ b/src/test/ui/mismatched_types/issue-47706.stderr
@@ -11,9 +11,6 @@ LL |         self.foo.map(Foo::new)
    |
 note: required by a bound in `Option::<T>::map`
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL
 
 error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
   --> $DIR/issue-47706.rs:27:9
diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr
index 9e11ca2e3ed..d3b7525072f 100644
--- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr
+++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr
@@ -8,8 +8,6 @@ LL |     a.unwrap();
    = note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
 note: required by a bound in `Result::<T, E>::unwrap`
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL
 help: consider annotating `Foo` with `#[derive(Debug)]`
    |
 LL | #[derive(Debug)]
diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr
index 13cb5a6e1f7..75561f4119a 100644
--- a/src/test/ui/no-send-res-ports.stderr
+++ b/src/test/ui/no-send-res-ports.stderr
@@ -31,10 +31,6 @@ LL |     thread::spawn(move|| {
    |                   ^^^^^^
 note: required by a bound in `spawn`
   --> $SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
-$SRC_DIR/std/src/thread/mod.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/on-unimplemented/sum.stderr b/src/test/ui/on-unimplemented/sum.stderr
index d8f10603de2..2a316dba778 100644
--- a/src/test/ui/on-unimplemented/sum.stderr
+++ b/src/test/ui/on-unimplemented/sum.stderr
@@ -17,9 +17,6 @@ LL |     vec![(), ()].iter().sum::<i32>();
    |     this expression has type `Vec<()>`
 note: required by a bound in `std::iter::Iterator::sum`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error[E0277]: a value of type `i32` cannot be made by multiplying all elements of type `&()` from an iterator
   --> $DIR/sum.rs:7:25
@@ -40,9 +37,6 @@ LL |     vec![(), ()].iter().product::<i32>();
    |     this expression has type `Vec<()>`
 note: required by a bound in `std::iter::Iterator::product`
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
-$SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr
index e0c88f81eac..2a016048f2f 100644
--- a/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr
+++ b/src/test/ui/pattern/suggest-adding-appropriate-missing-pattern-excluding-comments.stderr
@@ -6,7 +6,9 @@ LL |     match Some(1) {
    |
 note: `Option<i32>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<i32>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
diff --git a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
index 35e0661189f..17e1a2304a1 100644
--- a/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
+++ b/src/test/ui/pattern/usefulness/doc-hidden-non-exhaustive.stderr
@@ -66,7 +66,9 @@ LL |     match None {
    |
 note: `Option<HiddenEnum>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<HiddenEnum>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern, a match arm with multiple or-patterns as shown, or multiple match arms
    |
diff --git a/src/test/ui/pattern/usefulness/issue-3601.stderr b/src/test/ui/pattern/usefulness/issue-3601.stderr
index e8cfb3e7016..59d7bcd4b5e 100644
--- a/src/test/ui/pattern/usefulness/issue-3601.stderr
+++ b/src/test/ui/pattern/usefulness/issue-3601.stderr
@@ -6,9 +6,6 @@ LL |         box NodeKind::Element(ed) => match ed.kind {
    |
 note: `Box<ElementKind>` defined here
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
    = note: the matched value is of type `Box<ElementKind>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
diff --git a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr
index 36fc8899100..e4dd35a5995 100644
--- a/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr
+++ b/src/test/ui/pattern/usefulness/match-arm-statics-2.stderr
@@ -19,8 +19,11 @@ LL |     match Some(Some(North)) {
    |
 note: `Option<Option<Direction>>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
-: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
+   |
+   = note: not covered
    = note: the matched value is of type `Option<Option<Direction>>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
diff --git a/src/test/ui/pattern/usefulness/match-privately-empty.stderr b/src/test/ui/pattern/usefulness/match-privately-empty.stderr
index 9bb15ba8a42..86f75d15cfd 100644
--- a/src/test/ui/pattern/usefulness/match-privately-empty.stderr
+++ b/src/test/ui/pattern/usefulness/match-privately-empty.stderr
@@ -6,7 +6,9 @@ LL |     match private::DATA {
    |
 note: `Option<Private>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<Private>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
diff --git a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
index 1256867a652..e2260f50bfe 100644
--- a/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
+++ b/src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
@@ -36,7 +36,9 @@ LL |     match Some(10) {
    |
 note: `Option<i32>` defined here
   --> $SRC_DIR/core/src/option.rs:LL:COL
-$SRC_DIR/core/src/option.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Option<i32>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr
index bb59cb74a4e..79f2001da00 100644
--- a/src/test/ui/proc-macro/signature.stderr
+++ b/src/test/ui/proc-macro/signature.stderr
@@ -14,10 +14,6 @@ LL | | }
    = note: unsafe function cannot be called generically without an unsafe block
 note: required by a bound in `ProcMacro::custom_derive`
   --> $SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
-$SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
-$SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
-$SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
-$SRC_DIR/proc_macro/src/bridge/client.rs:LL:COL
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
index 429f0460e89..86ad6aa847c 100644
--- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
+++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
@@ -8,7 +8,9 @@ LL |     let Ok(x) = res;
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
 note: `Result<u32, &R<'_>>` defined here
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Result<u32, &R<'_>>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr
index 1994847b965..ca4b86ba306 100644
--- a/src/test/ui/str/str-mut-idx.stderr
+++ b/src/test/ui/str/str-mut-idx.stderr
@@ -63,9 +63,6 @@ LL |     s.get_unchecked_mut(1);
    = help: the trait `SliceIndex<[T]>` is implemented for `usize`
 note: required by a bound in `core::str::<impl str>::get_unchecked_mut`
   --> $SRC_DIR/core/src/str/mod.rs:LL:COL
-$SRC_DIR/core/src/str/mod.rs:LL:COL
-$SRC_DIR/core/src/str/mod.rs:LL:COL
-$SRC_DIR/core/src/str/mod.rs:LL:COL
 
 error[E0277]: the type `str` cannot be indexed by `char`
   --> $DIR/str-mut-idx.rs:13:7
diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr
index 18d0617a346..8ab6414d4d8 100644
--- a/src/test/ui/traits/issue-77982.stderr
+++ b/src/test/ui/traits/issue-77982.stderr
@@ -12,9 +12,6 @@ LL |     opts.get(opt.as_ref());
              where T: ?Sized;
 note: required by a bound in `HashMap::<K, V, S>::get`
   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
-$SRC_DIR/std/src/collections/hash/map.rs:LL:COL
 help: consider specifying the generic argument
    |
 LL |     opts.get::<Q>(opt.as_ref());
diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
index c375fd62877..d33a61ca848 100644
--- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
+++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
@@ -6,7 +6,9 @@ LL |     let _ = match x {
    |
 note: `Result<u32, &Void>` defined here
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Result<u32, &Void>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
@@ -83,7 +85,9 @@ LL |     let _ = match x {
    |
 note: `Result<u32, Void>` defined here
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Result<u32, Void>`
 help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
    |
@@ -101,7 +105,9 @@ LL |     let Ok(x) = x;
    = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
 note: `Result<u32, Void>` defined here
   --> $SRC_DIR/core/src/result.rs:LL:COL
-$SRC_DIR/core/src/result.rs:LL:COL: not covered
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
    = note: the matched value is of type `Result<u32, Void>`
 help: you might want to use `if let` to ignore the variant that isn't matched
    |
diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr
index 59e4c3ea5a1..db42ed9baf1 100644
--- a/src/test/ui/unique-object-noncopyable.stderr
+++ b/src/test/ui/unique-object-noncopyable.stderr
@@ -10,9 +10,9 @@ LL |   trait Foo {
 LL |       let _z = y.clone();
    |                  ^^^^^ method cannot be called on `Box<dyn Foo>` due to unsatisfied trait bounds
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL: doesn't satisfy `Box<dyn Foo>: Clone`
+  ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL
+   |
+   = note: doesn't satisfy `Box<dyn Foo>: Clone`
    |
    = note: the following trait bounds were not satisfied:
            `dyn Foo: Sized`
diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr
index eb7ce73454c..de6611324ca 100644
--- a/src/test/ui/unique-pinned-nocopy.stderr
+++ b/src/test/ui/unique-pinned-nocopy.stderr
@@ -7,9 +7,9 @@ LL |   struct R {
 LL |       let _j = i.clone();
    |                  ^^^^^ method cannot be called on `Box<R>` due to unsatisfied trait bounds
   --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL
-$SRC_DIR/alloc/src/boxed.rs:LL:COL: doesn't satisfy `Box<R>: Clone`
+  ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL
+   |
+   = note: doesn't satisfy `Box<R>: Clone`
    |
    = note: the following trait bounds were not satisfied:
            `R: Clone`