about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-07-09 17:00:19 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-07-18 20:08:38 +0000
commit2d7795dfb942d49d447837ef43db89216de15696 (patch)
treef1ef42e40392a1a0e1b7114662492507309e526e
parent89f273f40dafb693139496ed6f914872b6533fa6 (diff)
downloadrust-2d7795dfb942d49d447837ef43db89216de15696.tar.gz
rust-2d7795dfb942d49d447837ef43db89216de15696.zip
Be more accurate about calculating `display_col` from a `BytePos`
No longer track "zero-width" chars in `SourceMap`, read directly from the line when calculating the `display_col` of a `BytePos`. Move `char_width` to `rustc_span` and use it from the emitter.

This change allows the following to properly align in terminals (depending on the font, the replaced control codepoints are rendered as 1 or 2 width, on my terminal they are rendered as 1, on VSCode text they are rendered as 2):

```
error: this file contains an unclosed delimiter
  --> $DIR/issue-68629.rs:5:17
   |
LL | ␜␟ts␀![{i
   |       -- unclosed delimiter
   |       |
   |       unclosed delimiter
LL | ␀␀  fn rݻoa>rݻm
   |                ^
```
-rw-r--r--Cargo.lock1
-rw-r--r--compiler/rustc_errors/Cargo.toml1
-rw-r--r--compiler/rustc_errors/src/emitter.rs17
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs2
-rw-r--r--compiler/rustc_query_system/src/ich/impls_syntax.rs6
-rw-r--r--compiler/rustc_span/src/analyze_source_file.rs40
-rw-r--r--compiler/rustc_span/src/analyze_source_file/tests.rs24
-rw-r--r--compiler/rustc_span/src/lib.rs133
-rw-r--r--compiler/rustc_span/src/source_map.rs2
-rw-r--r--compiler/rustc_span/src/source_map/tests.rs2
-rw-r--r--tests/rustdoc-ui/doctest/test-compile-fail3.stderr2
-rw-r--r--tests/ui/codemap_tests/tab_2.stderr2
-rw-r--r--tests/ui/error-codes/E0601.stderr2
-rw-r--r--tests/ui/issues/issue-44078.stderr2
-rw-r--r--tests/ui/lexer/unterminated-comment.stderr2
-rw-r--r--tests/ui/lexer/unterminated-nested-comment.stderr2
-rw-r--r--tests/ui/lint/issue-104897.stderr2
-rw-r--r--tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr2
-rw-r--r--tests/ui/parser/bad-char-literals.stderr4
-rw-r--r--tests/ui/parser/brace-in-let-chain.stderr2
-rw-r--r--tests/ui/parser/byte-string-literals.stderr2
-rw-r--r--tests/ui/parser/deli-ident-issue-1.stderr2
-rw-r--r--tests/ui/parser/issues/issue-103451.stderr2
-rw-r--r--tests/ui/parser/issues/issue-104367.stderr2
-rw-r--r--tests/ui/parser/issues/issue-105209.stderr2
-rw-r--r--tests/ui/parser/issues/issue-107705.stderr2
-rw-r--r--tests/ui/parser/issues/issue-2354.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62546.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62554.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62881.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62894.stderr2
-rw-r--r--tests/ui/parser/issues/issue-62973.stderr2
-rw-r--r--tests/ui/parser/issues/issue-63116.stderr2
-rw-r--r--tests/ui/parser/issues/issue-63135.stderr2
-rw-r--r--tests/ui/parser/issues/issue-66473.stderr10
-rw-r--r--tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr2
-rw-r--r--tests/ui/parser/issues/issue-68629.stderr14
-rw-r--r--tests/ui/parser/issues/issue-68730.stderr12
-rw-r--r--tests/ui/parser/issues/issue-81804.stderr2
-rw-r--r--tests/ui/parser/issues/issue-81827.stderr2
-rw-r--r--tests/ui/parser/issues/issue-84104.stderr2
-rw-r--r--tests/ui/parser/issues/issue-84148-2.stderr2
-rw-r--r--tests/ui/parser/issues/issue-88770.stderr2
-rw-r--r--tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr2
-rw-r--r--tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr2
-rw-r--r--tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr2
-rw-r--r--tests/ui/parser/parser-ice-ed2021-await-105210.stderr2
-rw-r--r--tests/ui/parser/parser-recovery-1.stderr2
-rw-r--r--tests/ui/parser/several-carriage-returns-in-doc-comment.stderr4
-rw-r--r--tests/ui/parser/unbalanced-doublequote.stderr2
-rw-r--r--tests/ui/parser/unclosed-braces.stderr2
-rw-r--r--tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr2
-rw-r--r--tests/ui/parser/use-unclosed-brace.stderr2
-rw-r--r--tests/ui/parser/utf16-be-without-bom.stderr28
-rw-r--r--tests/ui/parser/utf16-le-without-bom.stderr24
-rw-r--r--tests/ui/rustdoc/unterminated-doc-comment.stderr2
-rw-r--r--tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr2
-rw-r--r--tests/ui/str/str-escape.stderr4
-rw-r--r--tests/ui/suggestions/issue-94171.stderr2
-rw-r--r--tests/ui/typeck/issue-91334.stderr2
60 files changed, 134 insertions, 278 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 1c1607e4c1a..d6060992ef2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4008,7 +4008,6 @@ dependencies = [
  "termcolor",
  "termize",
  "tracing",
- "unicode-width",
  "windows",
 ]
 
diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml
index cc114fdcd8c..2fff9f2de50 100644
--- a/compiler/rustc_errors/Cargo.toml
+++ b/compiler/rustc_errors/Cargo.toml
@@ -26,7 +26,6 @@ serde_json = "1.0.59"
 termcolor = "1.2.0"
 termize = "0.1.1"
 tracing = "0.1"
-unicode-width = "0.1.4"
 # tidy-alphabetical-end
 
 [target.'cfg(windows)'.dependencies.windows]
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 95e1b5348b7..16fa0ff7a2d 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -8,7 +8,7 @@
 //! The output types are defined in `rustc_session::config::ErrorOutputType`.
 
 use rustc_span::source_map::SourceMap;
-use rustc_span::{FileLines, FileName, SourceFile, Span};
+use rustc_span::{char_width, FileLines, FileName, SourceFile, Span};
 
 use crate::snippet::{
     Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
@@ -2614,21 +2614,6 @@ fn normalize_whitespace(str: &str) -> String {
     s
 }
 
-fn char_width(ch: char) -> usize {
-    // FIXME: `unicode_width` sometimes disagrees with terminals on how wide a `char` is. For now,
-    // just accept that sometimes the code line will be longer than desired.
-    match ch {
-        '\t' => 4,
-        '\u{0000}' | '\u{0001}' | '\u{0002}' | '\u{0003}' | '\u{0004}' | '\u{0005}'
-        | '\u{0006}' | '\u{0007}' | '\u{0008}' | '\u{000B}' | '\u{000C}' | '\u{000D}'
-        | '\u{000E}' | '\u{000F}' | '\u{0010}' | '\u{0011}' | '\u{0012}' | '\u{0013}'
-        | '\u{0014}' | '\u{0015}' | '\u{0016}' | '\u{0017}' | '\u{0018}' | '\u{0019}'
-        | '\u{001A}' | '\u{001B}' | '\u{001C}' | '\u{001D}' | '\u{001E}' | '\u{001F}'
-        | '\u{007F}' => 1,
-        _ => unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1),
-    }
-}
-
 fn draw_col_separator(buffer: &mut StyledBuffer, line: usize, col: usize) {
     buffer.puts(line, col, "| ", Style::LineNumber);
 }
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index 0ba9b940eed..9f2fe254753 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -1727,7 +1727,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
                     source_len,
                     lines,
                     multibyte_chars,
-                    non_narrow_chars,
                     normalized_pos,
                     stable_id,
                     ..
@@ -1779,7 +1778,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
                     self.cnum,
                     lines,
                     multibyte_chars,
-                    non_narrow_chars,
                     normalized_pos,
                     source_file_index,
                 );
diff --git a/compiler/rustc_query_system/src/ich/impls_syntax.rs b/compiler/rustc_query_system/src/ich/impls_syntax.rs
index 5bd4fe04848..39da5e395c4 100644
--- a/compiler/rustc_query_system/src/ich/impls_syntax.rs
+++ b/compiler/rustc_query_system/src/ich/impls_syntax.rs
@@ -73,7 +73,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
             source_len: _,
             lines: _,
             ref multibyte_chars,
-            ref non_narrow_chars,
             ref normalized_pos,
         } = *self;
 
@@ -98,11 +97,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
             char_pos.hash_stable(hcx, hasher);
         }
 
-        non_narrow_chars.len().hash_stable(hcx, hasher);
-        for &char_pos in non_narrow_chars.iter() {
-            char_pos.hash_stable(hcx, hasher);
-        }
-
         normalized_pos.len().hash_stable(hcx, hasher);
         for &char_pos in normalized_pos.iter() {
             char_pos.hash_stable(hcx, hasher);
diff --git a/compiler/rustc_span/src/analyze_source_file.rs b/compiler/rustc_span/src/analyze_source_file.rs
index d9e1ebaf0bc..ba7e0cec5bd 100644
--- a/compiler/rustc_span/src/analyze_source_file.rs
+++ b/compiler/rustc_span/src/analyze_source_file.rs
@@ -1,5 +1,4 @@
 use super::*;
-use unicode_width::UnicodeWidthChar;
 
 #[cfg(test)]
 mod tests;
@@ -9,15 +8,12 @@ mod tests;
 ///
 /// This function will use an SSE2 enhanced implementation if hardware support
 /// is detected at runtime.
-pub fn analyze_source_file(
-    src: &str,
-) -> (Vec<RelativeBytePos>, Vec<MultiByteChar>, Vec<NonNarrowChar>) {
+pub fn analyze_source_file(src: &str) -> (Vec<RelativeBytePos>, Vec<MultiByteChar>) {
     let mut lines = vec![RelativeBytePos::from_u32(0)];
     let mut multi_byte_chars = vec![];
-    let mut non_narrow_chars = vec![];
 
     // Calls the right implementation, depending on hardware support available.
-    analyze_source_file_dispatch(src, &mut lines, &mut multi_byte_chars, &mut non_narrow_chars);
+    analyze_source_file_dispatch(src, &mut lines, &mut multi_byte_chars);
 
     // The code above optimistically registers a new line *after* each \n
     // it encounters. If that point is already outside the source_file, remove
@@ -30,7 +26,7 @@ pub fn analyze_source_file(
         }
     }
 
-    (lines, multi_byte_chars, non_narrow_chars)
+    (lines, multi_byte_chars)
 }
 
 cfg_match! {
@@ -39,11 +35,10 @@ cfg_match! {
             src: &str,
             lines: &mut Vec<RelativeBytePos>,
             multi_byte_chars: &mut Vec<MultiByteChar>,
-            non_narrow_chars: &mut Vec<NonNarrowChar>,
         ) {
             if is_x86_feature_detected!("sse2") {
                 unsafe {
-                    analyze_source_file_sse2(src, lines, multi_byte_chars, non_narrow_chars);
+                    analyze_source_file_sse2(src, lines, multi_byte_chars);
                 }
             } else {
                 analyze_source_file_generic(
@@ -52,7 +47,6 @@ cfg_match! {
                     RelativeBytePos::from_u32(0),
                     lines,
                     multi_byte_chars,
-                    non_narrow_chars,
                 );
             }
         }
@@ -66,7 +60,6 @@ cfg_match! {
             src: &str,
             lines: &mut Vec<RelativeBytePos>,
             multi_byte_chars: &mut Vec<MultiByteChar>,
-            non_narrow_chars: &mut Vec<NonNarrowChar>,
         ) {
             #[cfg(target_arch = "x86")]
             use std::arch::x86::*;
@@ -159,7 +152,6 @@ cfg_match! {
                     RelativeBytePos::from_usize(scan_start),
                     lines,
                     multi_byte_chars,
-                    non_narrow_chars,
                 );
             }
 
@@ -172,7 +164,6 @@ cfg_match! {
                     RelativeBytePos::from_usize(tail_start),
                     lines,
                     multi_byte_chars,
-                    non_narrow_chars,
                 );
             }
         }
@@ -183,7 +174,6 @@ cfg_match! {
             src: &str,
             lines: &mut Vec<RelativeBytePos>,
             multi_byte_chars: &mut Vec<MultiByteChar>,
-            non_narrow_chars: &mut Vec<NonNarrowChar>,
         ) {
             analyze_source_file_generic(
                 src,
@@ -191,7 +181,6 @@ cfg_match! {
                 RelativeBytePos::from_u32(0),
                 lines,
                 multi_byte_chars,
-                non_narrow_chars,
             );
         }
     }
@@ -205,7 +194,6 @@ fn analyze_source_file_generic(
     output_offset: RelativeBytePos,
     lines: &mut Vec<RelativeBytePos>,
     multi_byte_chars: &mut Vec<MultiByteChar>,
-    non_narrow_chars: &mut Vec<NonNarrowChar>,
 ) -> usize {
     assert!(src.len() >= scan_len);
     let mut i = 0;
@@ -227,16 +215,8 @@ fn analyze_source_file_generic(
 
             let pos = RelativeBytePos::from_usize(i) + output_offset;
 
-            match byte {
-                b'\n' => {
-                    lines.push(pos + RelativeBytePos(1));
-                }
-                b'\t' => {
-                    non_narrow_chars.push(NonNarrowChar::Tab(pos));
-                }
-                _ => {
-                    non_narrow_chars.push(NonNarrowChar::ZeroWidth(pos));
-                }
+            if let b'\n' = byte {
+                lines.push(pos + RelativeBytePos(1));
             }
         } else if byte >= 127 {
             // The slow path:
@@ -252,14 +232,6 @@ fn analyze_source_file_generic(
                 let mbc = MultiByteChar { pos, bytes: char_len as u8 };
                 multi_byte_chars.push(mbc);
             }
-
-            // Assume control characters are zero width.
-            // FIXME: How can we decide between `width` and `width_cjk`?
-            let char_width = UnicodeWidthChar::width(c).unwrap_or(0);
-
-            if char_width != 1 {
-                non_narrow_chars.push(NonNarrowChar::new(pos, char_width));
-            }
         }
 
         i += char_len;
diff --git a/compiler/rustc_span/src/analyze_source_file/tests.rs b/compiler/rustc_span/src/analyze_source_file/tests.rs
index 0c77d080c17..e4a24239d8e 100644
--- a/compiler/rustc_span/src/analyze_source_file/tests.rs
+++ b/compiler/rustc_span/src/analyze_source_file/tests.rs
@@ -4,11 +4,10 @@ macro_rules! test {
     (case: $test_name:ident,
      text: $text:expr,
      lines: $lines:expr,
-     multi_byte_chars: $multi_byte_chars:expr,
-     non_narrow_chars: $non_narrow_chars:expr,) => {
+     multi_byte_chars: $multi_byte_chars:expr,) => {
         #[test]
         fn $test_name() {
-            let (lines, multi_byte_chars, non_narrow_chars) = analyze_source_file($text);
+            let (lines, multi_byte_chars) = analyze_source_file($text);
 
             let expected_lines: Vec<RelativeBytePos> =
                 $lines.into_iter().map(RelativeBytePos).collect();
@@ -21,13 +20,6 @@ macro_rules! test {
                 .collect();
 
             assert_eq!(multi_byte_chars, expected_mbcs);
-
-            let expected_nncs: Vec<NonNarrowChar> = $non_narrow_chars
-                .into_iter()
-                .map(|(pos, width)| NonNarrowChar::new(RelativeBytePos(pos), width))
-                .collect();
-
-            assert_eq!(non_narrow_chars, expected_nncs);
         }
     };
 }
@@ -37,7 +29,6 @@ test!(
     text: "",
     lines: vec![],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -45,7 +36,6 @@ test!(
     text: "a\nc",
     lines: vec![0, 2],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -53,7 +43,6 @@ test!(
     text: "012345678\nabcdef012345678\na",
     lines: vec![0, 10, 26],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -61,7 +50,6 @@ test!(
     text: "01234β789\nbcdef0123456789abcdef",
     lines: vec![0, 11],
     multi_byte_chars: vec![(5, 2)],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -69,7 +57,6 @@ test!(
     text: "01234\u{07}6789\nbcdef0123456789abcdef",
     lines: vec![0, 11],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![(5, 0)],
 );
 
 test!(
@@ -77,7 +64,6 @@ test!(
     text: "aβc",
     lines: vec![0],
     multi_byte_chars: vec![(1, 2)],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -85,7 +71,6 @@ test!(
     text: "0123456789abcΔf012345β",
     lines: vec![0],
     multi_byte_chars: vec![(13, 2), (22, 2)],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -93,7 +78,6 @@ test!(
     text: "0123456789abcdeΔ123456789abcdef01234",
     lines: vec![0],
     multi_byte_chars: vec![(15, 2)],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -101,7 +85,6 @@ test!(
     text: "0123456789abcdeΔ....",
     lines: vec![0],
     multi_byte_chars: vec![(15, 2)],
-    non_narrow_chars: vec![],
 );
 
 test!(
@@ -109,7 +92,6 @@ test!(
     text: "0\t2",
     lines: vec![0],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![(1, 4)],
 );
 
 test!(
@@ -117,7 +99,6 @@ test!(
     text: "01\t3456789abcdef01234567\u{07}9",
     lines: vec![0],
     multi_byte_chars: vec![],
-    non_narrow_chars: vec![(2, 4), (24, 0)],
 );
 
 test!(
@@ -125,5 +106,4 @@ test!(
     text: "01\t345\n789abcΔf01234567\u{07}9\nbcΔf",
     lines: vec![0, 7, 27],
     multi_byte_chars: vec![(13, 2), (29, 2)],
-    non_narrow_chars: vec![(2, 4), (24, 0)],
 );
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 266956d63d7..ea57c1ce818 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -1345,68 +1345,6 @@ pub struct MultiByteChar {
     pub bytes: u8,
 }
 
-/// Identifies an offset of a non-narrow character in a `SourceFile`.
-#[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)]
-pub enum NonNarrowChar {
-    /// Represents a zero-width character.
-    ZeroWidth(RelativeBytePos),
-    /// Represents a wide (full-width) character.
-    Wide(RelativeBytePos),
-    /// Represents a tab character, represented visually with a width of 4 characters.
-    Tab(RelativeBytePos),
-}
-
-impl NonNarrowChar {
-    fn new(pos: RelativeBytePos, width: usize) -> Self {
-        match width {
-            0 => NonNarrowChar::ZeroWidth(pos),
-            2 => NonNarrowChar::Wide(pos),
-            4 => NonNarrowChar::Tab(pos),
-            _ => panic!("width {width} given for non-narrow character"),
-        }
-    }
-
-    /// Returns the relative offset of the character in the `SourceFile`.
-    pub fn pos(&self) -> RelativeBytePos {
-        match *self {
-            NonNarrowChar::ZeroWidth(p) | NonNarrowChar::Wide(p) | NonNarrowChar::Tab(p) => p,
-        }
-    }
-
-    /// Returns the width of the character, 0 (zero-width) or 2 (wide).
-    pub fn width(&self) -> usize {
-        match *self {
-            NonNarrowChar::ZeroWidth(_) => 0,
-            NonNarrowChar::Wide(_) => 2,
-            NonNarrowChar::Tab(_) => 4,
-        }
-    }
-}
-
-impl Add<RelativeBytePos> for NonNarrowChar {
-    type Output = Self;
-
-    fn add(self, rhs: RelativeBytePos) -> Self {
-        match self {
-            NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos + rhs),
-            NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos + rhs),
-            NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos + rhs),
-        }
-    }
-}
-
-impl Sub<RelativeBytePos> for NonNarrowChar {
-    type Output = Self;
-
-    fn sub(self, rhs: RelativeBytePos) -> Self {
-        match self {
-            NonNarrowChar::ZeroWidth(pos) => NonNarrowChar::ZeroWidth(pos - rhs),
-            NonNarrowChar::Wide(pos) => NonNarrowChar::Wide(pos - rhs),
-            NonNarrowChar::Tab(pos) => NonNarrowChar::Tab(pos - rhs),
-        }
-    }
-}
-
 /// Identifies an offset of a character that was normalized away from `SourceFile`.
 #[derive(Copy, Clone, Encodable, Decodable, Eq, PartialEq, Debug, HashStable_Generic)]
 pub struct NormalizedPos {
@@ -1581,8 +1519,6 @@ pub struct SourceFile {
     pub lines: FreezeLock<SourceFileLines>,
     /// Locations of multi-byte characters in the source code.
     pub multibyte_chars: Vec<MultiByteChar>,
-    /// Width of characters that are not narrow in the source code.
-    pub non_narrow_chars: Vec<NonNarrowChar>,
     /// Locations of characters removed during normalization.
     pub normalized_pos: Vec<NormalizedPos>,
     /// A hash of the filename & crate-id, used for uniquely identifying source
@@ -1604,7 +1540,6 @@ impl Clone for SourceFile {
             source_len: self.source_len,
             lines: self.lines.clone(),
             multibyte_chars: self.multibyte_chars.clone(),
-            non_narrow_chars: self.non_narrow_chars.clone(),
             normalized_pos: self.normalized_pos.clone(),
             stable_id: self.stable_id,
             cnum: self.cnum,
@@ -1679,7 +1614,6 @@ impl<S: SpanEncoder> Encodable<S> for SourceFile {
         }
 
         self.multibyte_chars.encode(s);
-        self.non_narrow_chars.encode(s);
         self.stable_id.encode(s);
         self.normalized_pos.encode(s);
         self.cnum.encode(s);
@@ -1706,7 +1640,6 @@ impl<D: SpanDecoder> Decodable<D> for SourceFile {
             }
         };
         let multibyte_chars: Vec<MultiByteChar> = Decodable::decode(d);
-        let non_narrow_chars: Vec<NonNarrowChar> = Decodable::decode(d);
         let stable_id = Decodable::decode(d);
         let normalized_pos: Vec<NormalizedPos> = Decodable::decode(d);
         let cnum: CrateNum = Decodable::decode(d);
@@ -1721,7 +1654,6 @@ impl<D: SpanDecoder> Decodable<D> for SourceFile {
             external_src: FreezeLock::frozen(ExternalSource::Unneeded),
             lines: FreezeLock::new(lines),
             multibyte_chars,
-            non_narrow_chars,
             normalized_pos,
             stable_id,
             cnum,
@@ -1809,8 +1741,7 @@ impl SourceFile {
         let source_len = src.len();
         let source_len = u32::try_from(source_len).map_err(|_| OffsetOverflowError)?;
 
-        let (lines, multibyte_chars, non_narrow_chars) =
-            analyze_source_file::analyze_source_file(&src);
+        let (lines, multibyte_chars) = analyze_source_file::analyze_source_file(&src);
 
         Ok(SourceFile {
             name,
@@ -1821,7 +1752,6 @@ impl SourceFile {
             source_len: RelativeBytePos::from_u32(source_len),
             lines: FreezeLock::frozen(SourceFileLines::Lines(lines)),
             multibyte_chars,
-            non_narrow_chars,
             normalized_pos,
             stable_id,
             cnum: LOCAL_CRATE,
@@ -2130,41 +2060,44 @@ impl SourceFile {
         let pos = self.relative_position(pos);
         let (line, col_or_chpos) = self.lookup_file_pos(pos);
         if line > 0 {
-            let col = col_or_chpos;
-            let linebpos = self.lines()[line - 1];
-            let col_display = {
-                let start_width_idx = self
-                    .non_narrow_chars
-                    .binary_search_by_key(&linebpos, |x| x.pos())
-                    .unwrap_or_else(|x| x);
-                let end_width_idx = self
-                    .non_narrow_chars
-                    .binary_search_by_key(&pos, |x| x.pos())
-                    .unwrap_or_else(|x| x);
-                let special_chars = end_width_idx - start_width_idx;
-                let non_narrow: usize = self.non_narrow_chars[start_width_idx..end_width_idx]
-                    .iter()
-                    .map(|x| x.width())
-                    .sum();
-                col.0 - special_chars + non_narrow
+            let Some(code) = self.get_line(line - 1) else {
+                // If we don't have the code available, it is ok as a fallback to return the bytepos
+                // instead of the "display" column, which is only used to properly show underlines
+                // in the terminal.
+                // FIXME: we'll want better handling of this in the future for the sake of tools
+                // that want to use the display col instead of byte offsets to modify Rust code, but
+                // that is a problem for another day, the previous code was already incorrect for
+                // both displaying *and* third party tools using the json output naïvely.
+                tracing::info!("couldn't find line {line} {:?}", self.name);
+                return (line, col_or_chpos, col_or_chpos.0);
             };
-            (line, col, col_display)
+            let display_col = code.chars().take(col_or_chpos.0).map(|ch| char_width(ch)).sum();
+            (line, col_or_chpos, display_col)
         } else {
-            let chpos = col_or_chpos;
-            let col_display = {
-                let end_width_idx = self
-                    .non_narrow_chars
-                    .binary_search_by_key(&pos, |x| x.pos())
-                    .unwrap_or_else(|x| x);
-                let non_narrow: usize =
-                    self.non_narrow_chars[0..end_width_idx].iter().map(|x| x.width()).sum();
-                chpos.0 - end_width_idx + non_narrow
-            };
-            (0, chpos, col_display)
+            // This is never meant to happen?
+            (0, col_or_chpos, col_or_chpos.0)
         }
     }
 }
 
+pub fn char_width(ch: char) -> usize {
+    // FIXME: `unicode_width` sometimes disagrees with terminals on how wide a `char` is. For now,
+    // just accept that sometimes the code line will be longer than desired.
+    match ch {
+        '\t' => 4,
+        // Keep the following list in sync with `rustc_errors::emitter::OUTPUT_REPLACEMENTS`. These
+        // are control points that we replace before printing with a visible codepoint for the sake
+        // of being able to point at them with underlines.
+        '\u{0000}' | '\u{0001}' | '\u{0002}' | '\u{0003}' | '\u{0004}' | '\u{0005}'
+        | '\u{0006}' | '\u{0007}' | '\u{0008}' | '\u{000B}' | '\u{000C}' | '\u{000D}'
+        | '\u{000E}' | '\u{000F}' | '\u{0010}' | '\u{0011}' | '\u{0012}' | '\u{0013}'
+        | '\u{0014}' | '\u{0015}' | '\u{0016}' | '\u{0017}' | '\u{0018}' | '\u{0019}'
+        | '\u{001A}' | '\u{001B}' | '\u{001C}' | '\u{001D}' | '\u{001E}' | '\u{001F}'
+        | '\u{007F}' => 1,
+        _ => unicode_width::UnicodeWidthChar::width(ch).unwrap_or(1),
+    }
+}
+
 /// Normalizes the source code and records the normalizations.
 fn normalize_src(src: &mut String) -> Vec<NormalizedPos> {
     let mut normalized_pos = vec![];
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs
index fb212d67997..14c157a0111 100644
--- a/compiler/rustc_span/src/source_map.rs
+++ b/compiler/rustc_span/src/source_map.rs
@@ -330,7 +330,6 @@ impl SourceMap {
         cnum: CrateNum,
         file_local_lines: FreezeLock<SourceFileLines>,
         multibyte_chars: Vec<MultiByteChar>,
-        non_narrow_chars: Vec<NonNarrowChar>,
         normalized_pos: Vec<NormalizedPos>,
         metadata_index: u32,
     ) -> Lrc<SourceFile> {
@@ -348,7 +347,6 @@ impl SourceMap {
             source_len,
             lines: file_local_lines,
             multibyte_chars,
-            non_narrow_chars,
             normalized_pos,
             stable_id,
             cnum,
diff --git a/compiler/rustc_span/src/source_map/tests.rs b/compiler/rustc_span/src/source_map/tests.rs
index dcb02da3719..0c818b94b85 100644
--- a/compiler/rustc_span/src/source_map/tests.rs
+++ b/compiler/rustc_span/src/source_map/tests.rs
@@ -232,7 +232,6 @@ fn t10() {
         source_len,
         lines,
         multibyte_chars,
-        non_narrow_chars,
         normalized_pos,
         stable_id,
         ..
@@ -246,7 +245,6 @@ fn t10() {
         CrateNum::ZERO,
         FreezeLock::new(lines.read().clone()),
         multibyte_chars,
-        non_narrow_chars,
         normalized_pos,
         0,
     );
diff --git a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
index 1ed45542251..09d78b2f346 100644
--- a/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
+++ b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr
@@ -2,7 +2,7 @@ error[E0765]: unterminated double quote string
  --> $DIR/test-compile-fail3.rs:3:1
   |
 3 | "fail
-  | ^^^^^^
+  | ^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/codemap_tests/tab_2.stderr b/tests/ui/codemap_tests/tab_2.stderr
index 4f9a937155d..b22c7b42665 100644
--- a/tests/ui/codemap_tests/tab_2.stderr
+++ b/tests/ui/codemap_tests/tab_2.stderr
@@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string
 LL |                   """;
    |  ___________________^
 LL | | }
-   | |__^
+   | |_^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/error-codes/E0601.stderr b/tests/ui/error-codes/E0601.stderr
index 41a4a8f7dbb..c051bc0b31a 100644
--- a/tests/ui/error-codes/E0601.stderr
+++ b/tests/ui/error-codes/E0601.stderr
@@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `E0601`
   --> $DIR/E0601.rs:1:37
    |
 LL |
-   |                                     ^ consider adding a `main` function to `$DIR/E0601.rs`
+   |                                    ^ consider adding a `main` function to `$DIR/E0601.rs`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/issues/issue-44078.stderr b/tests/ui/issues/issue-44078.stderr
index 3e12de34e11..41106b29aad 100644
--- a/tests/ui/issues/issue-44078.stderr
+++ b/tests/ui/issues/issue-44078.stderr
@@ -4,7 +4,7 @@ error[E0765]: unterminated double quote string
 LL |       "😊"";
    |  _________^
 LL | | }
-   | |__^
+   | |_^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lexer/unterminated-comment.stderr b/tests/ui/lexer/unterminated-comment.stderr
index ea65bffd103..6ab5441ee05 100644
--- a/tests/ui/lexer/unterminated-comment.stderr
+++ b/tests/ui/lexer/unterminated-comment.stderr
@@ -2,7 +2,7 @@ error[E0758]: unterminated block comment
   --> $DIR/unterminated-comment.rs:1:1
    |
 LL | /*
-   | ^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lexer/unterminated-nested-comment.stderr b/tests/ui/lexer/unterminated-nested-comment.stderr
index 9117b689c94..78b72ce1fe4 100644
--- a/tests/ui/lexer/unterminated-nested-comment.stderr
+++ b/tests/ui/lexer/unterminated-nested-comment.stderr
@@ -12,7 +12,7 @@ LL | | /*
    | | |
    | | ...as last nested comment starts here, maybe you want to close this instead?
 LL | | */
-   | |_--^
+   | |_-^
    |   |
    |   ...and last nested comment terminates here.
 
diff --git a/tests/ui/lint/issue-104897.stderr b/tests/ui/lint/issue-104897.stderr
index 1f3d40605f6..584902ee4c0 100644
--- a/tests/ui/lint/issue-104897.stderr
+++ b/tests/ui/lint/issue-104897.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-104897.rs:5:18
    |
 LL | fn f(){(print!(á
-   |       --      -  ^
+   |       --      - ^
    |       ||      |
    |       ||      unclosed delimiter
    |       |unclosed delimiter
diff --git a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr
index ad90aeda1d1..d9748843fd7 100644
--- a/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr
+++ b/tests/ui/malformed/issue-107423-unused-delim-only-one-no-pair.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-107423-unused-delim-only-one-no-pair.rs:7:11
    |
 LL | fn a(){{{
-   |       --- ^
+   |       ---^
    |       |||
    |       ||unclosed delimiter
    |       |unclosed delimiter
diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr
index 38889da5da1..1fb324a1b7e 100644
--- a/tests/ui/parser/bad-char-literals.stderr
+++ b/tests/ui/parser/bad-char-literals.stderr
@@ -37,12 +37,12 @@ error: character literal may only contain one codepoint
   --> $DIR/bad-char-literals.rs:18:5
    |
 LL |     '-␀-';
-   |     ^^^^
+   |     ^^^^^
    |
 help: if you meant to write a string literal, use double quotes
    |
 LL |     "-␀-";
-   |     ~  ~
+   |     ~   ~
 
 error: character constant must be escaped: `\t`
   --> $DIR/bad-char-literals.rs:21:6
diff --git a/tests/ui/parser/brace-in-let-chain.stderr b/tests/ui/parser/brace-in-let-chain.stderr
index 7182d86d001..d76cb25ad8b 100644
--- a/tests/ui/parser/brace-in-let-chain.stderr
+++ b/tests/ui/parser/brace-in-let-chain.stderr
@@ -31,7 +31,7 @@ LL |             && let () = ()
 LL |     }
    |     - ...as it matches this but it has different indentation
 LL | }
-   |                                                      ^
+   |                                                     ^
 
 error: found a `{` in the middle of a let-chain
   --> $DIR/brace-in-let-chain.rs:14:24
diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr
index 655b6998e85..24e0eaac8fa 100644
--- a/tests/ui/parser/byte-string-literals.stderr
+++ b/tests/ui/parser/byte-string-literals.stderr
@@ -43,7 +43,7 @@ error[E0766]: unterminated double quote byte string
 LL |       b"a
    |  ______^
 LL | | }
-   | |__^
+   | |_^
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/parser/deli-ident-issue-1.stderr b/tests/ui/parser/deli-ident-issue-1.stderr
index 78f5d7b63b9..d17913eb7ea 100644
--- a/tests/ui/parser/deli-ident-issue-1.stderr
+++ b/tests/ui/parser/deli-ident-issue-1.stderr
@@ -11,7 +11,7 @@ LL |     }
    |     - ...as it matches this but it has different indentation
 ...
 LL | fn main() { }
-   |                                                                  ^
+   |                                                                 ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-103451.stderr b/tests/ui/parser/issues/issue-103451.stderr
index 7ad816e451e..f078e556e2b 100644
--- a/tests/ui/parser/issues/issue-103451.stderr
+++ b/tests/ui/parser/issues/issue-103451.stderr
@@ -4,7 +4,7 @@ error: this file contains an unclosed delimiter
 LL | struct S {
    |          - unclosed delimiter
 LL |     x: [u8; R
-   |        -      ^
+   |        -     ^
    |        |
    |        unclosed delimiter
 
diff --git a/tests/ui/parser/issues/issue-104367.stderr b/tests/ui/parser/issues/issue-104367.stderr
index e6e76535761..c067d12e2d9 100644
--- a/tests/ui/parser/issues/issue-104367.stderr
+++ b/tests/ui/parser/issues/issue-104367.stderr
@@ -20,7 +20,7 @@ LL |         #![cfg] {
 LL |             #![w,)
    |                  - missing open `(` for this delimiter
 LL |
-   |                                                                       ^
+   |                                                                      ^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/parser/issues/issue-105209.stderr b/tests/ui/parser/issues/issue-105209.stderr
index c75eafa1833..72017e4327d 100644
--- a/tests/ui/parser/issues/issue-105209.stderr
+++ b/tests/ui/parser/issues/issue-105209.stderr
@@ -16,7 +16,7 @@ LL | #![c={#![c[)x
    |   |  unclosed delimiter
    |   unclosed delimiter
 LL |
-   |                                                                    ^
+   |                                                                   ^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/parser/issues/issue-107705.stderr b/tests/ui/parser/issues/issue-107705.stderr
index 2d0c3e0e675..10a47b79931 100644
--- a/tests/ui/parser/issues/issue-107705.stderr
+++ b/tests/ui/parser/issues/issue-107705.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-107705.rs:3:67
    |
 LL | fn f() {a(b:&,
-   |        - - unclosed delimiter                                     ^
+   |        - - unclosed delimiter                                    ^
    |        |
    |        unclosed delimiter
 
diff --git a/tests/ui/parser/issues/issue-2354.stderr b/tests/ui/parser/issues/issue-2354.stderr
index fd649a575c6..3e63473b6f4 100644
--- a/tests/ui/parser/issues/issue-2354.stderr
+++ b/tests/ui/parser/issues/issue-2354.stderr
@@ -10,7 +10,7 @@ LL | }
    | - ...as it matches this but it has different indentation
 ...
 LL |
-   |                                                    ^
+   |                                                   ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-62546.stderr b/tests/ui/parser/issues/issue-62546.stderr
index 6889cb3b8e9..6435cb2b719 100644
--- a/tests/ui/parser/issues/issue-62546.stderr
+++ b/tests/ui/parser/issues/issue-62546.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-62546.rs:1:60
    |
 LL | pub t(#
-   |      - unclosed delimiter                                  ^
+   |      - unclosed delimiter                                 ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-62554.stderr b/tests/ui/parser/issues/issue-62554.stderr
index 37314dd39c7..d4aaef16181 100644
--- a/tests/ui/parser/issues/issue-62554.stderr
+++ b/tests/ui/parser/issues/issue-62554.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-62554.rs:5:89
    |
 LL | fn foo(u: u8) { if u8 macro_rules! u8 { (u6) => { fn uuuuuuuuuuu() { use s loo mod u8 {
-   |               -                       -         -                  -                  - ^
+   |               -                       -         -                  -                  -^
    |               |                       |         |                  |                  |
    |               |                       |         |                  |                  unclosed delimiter
    |               |                       |         |                  unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-62881.stderr b/tests/ui/parser/issues/issue-62881.stderr
index 2165a81a048..d8ae2cf0905 100644
--- a/tests/ui/parser/issues/issue-62881.stderr
+++ b/tests/ui/parser/issues/issue-62881.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-62881.rs:3:96
    |
 LL | fn f() -> isize { fn f() -> isize {} pub f<
-   |                 - unclosed delimiter                                                           ^
+   |                 - unclosed delimiter                                                          ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-62894.stderr b/tests/ui/parser/issues/issue-62894.stderr
index 870633fc96f..230319fc31e 100644
--- a/tests/ui/parser/issues/issue-62894.stderr
+++ b/tests/ui/parser/issues/issue-62894.stderr
@@ -8,7 +8,7 @@ LL | fn f() { assert_eq!(f(), (), assert_eq!(assert_eq!
    |        unclosed delimiter
 LL |
 LL | fn main() {}
-   |              ^
+   |             ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/issues/issue-62973.stderr b/tests/ui/parser/issues/issue-62973.stderr
index 14411a8cb78..493183988e1 100644
--- a/tests/ui/parser/issues/issue-62973.stderr
+++ b/tests/ui/parser/issues/issue-62973.stderr
@@ -25,7 +25,7 @@ LL | fn p() { match s { v, E { [) {) }
    |        unclosed delimiter
 LL |
 LL |
-   |  ^
+   | ^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/parser/issues/issue-63116.stderr b/tests/ui/parser/issues/issue-63116.stderr
index 27c94f337bd..e0f7dd176ce 100644
--- a/tests/ui/parser/issues/issue-63116.stderr
+++ b/tests/ui/parser/issues/issue-63116.stderr
@@ -10,7 +10,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-63116.rs:3:18
    |
 LL | impl W <s(f;Y(;]
-   |          -     - ^
+   |          -     -^
    |          |     |
    |          |     missing open `[` for this delimiter
    |          unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-63135.stderr b/tests/ui/parser/issues/issue-63135.stderr
index 9204f561e96..d6275901a53 100644
--- a/tests/ui/parser/issues/issue-63135.stderr
+++ b/tests/ui/parser/issues/issue-63135.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-63135.rs:3:16
    |
 LL | fn i(n{...,f #
-   |     - -        ^
+   |     - -       ^
    |     | |
    |     | unclosed delimiter
    |     unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-66473.stderr b/tests/ui/parser/issues/issue-66473.stderr
index 4be992d5846..ba38c4fa1b7 100644
--- a/tests/ui/parser/issues/issue-66473.stderr
+++ b/tests/ui/parser/issues/issue-66473.stderr
@@ -8,7 +8,7 @@ error: unknown start of token: \u{0}
   --> $DIR/issue-66473.rs:4:3
    |
 LL | #͈␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
-   |  ^
+   |  ^^^^^^^^^^^^^^^^^^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
    = note: character appears 17 more times
@@ -17,19 +17,19 @@ error: unknown start of token: \u{1d}
   --> $DIR/issue-66473.rs:5:2
    |
 LL | ␋␝6␝␀␀
-   | ^
+   |  ^
 
 error: unknown start of token: \u{1d}
   --> $DIR/issue-66473.rs:5:4
    |
 LL | ␋␝6␝␀␀
-   |  ^
+   |    ^
 
 error: unknown start of token: \u{0}
   --> $DIR/issue-66473.rs:5:5
    |
 LL | ␋␝6␝␀␀
-   |  ^
+   |     ^^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
    = note: character appears once more
@@ -40,7 +40,7 @@ error: expected one of `!` or `[`, found `6`
 LL | #͈␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀␀
    |  - expected one of `!` or `[`
 LL | ␋␝6␝␀␀
-   | ^ unexpected token
+   |   ^ unexpected token
 
 error: aborting due to 6 previous errors
 
diff --git a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
index 9f631edf680..b82b0f3255b 100644
--- a/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
+++ b/tests/ui/parser/issues/issue-67377-invalid-syntax-in-enum-discriminant.stderr
@@ -41,7 +41,7 @@ LL |         V = [Vec::new; { [0].len() ].len() as isize,
    |                                    - missing open `[` for this delimiter
 ...
 LL | fn main() {}
-   |                                                                 ^
+   |                                                                ^
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/parser/issues/issue-68629.stderr b/tests/ui/parser/issues/issue-68629.stderr
index ccb0624208b..f003f378179 100644
--- a/tests/ui/parser/issues/issue-68629.stderr
+++ b/tests/ui/parser/issues/issue-68629.stderr
@@ -8,13 +8,13 @@ error: unknown start of token: \u{1f}
   --> $DIR/issue-68629.rs:4:2
    |
 LL | ␜␟ts␀![{i
-   | ^
+   |  ^
 
 error: unknown start of token: \u{0}
   --> $DIR/issue-68629.rs:4:5
    |
 LL | ␜␟ts␀![{i
-   |   ^
+   |     ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -22,7 +22,7 @@ error: unknown start of token: \u{0}
   --> $DIR/issue-68629.rs:5:1
    |
 LL | ␀␀  fn rݻoa>rݻm
-   | ^
+   | ^^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
    = note: character appears once more
@@ -31,11 +31,11 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-68629.rs:5:17
    |
 LL | ␜␟ts␀![{i
-   |    -- unclosed delimiter
-   |    |
-   |    unclosed delimiter
+   |       -- unclosed delimiter
+   |       |
+   |       unclosed delimiter
 LL | ␀␀  fn rݻoa>rݻm
-   |               ^
+   |                ^
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/parser/issues/issue-68730.stderr b/tests/ui/parser/issues/issue-68730.stderr
index 6025ea8c1ae..9bd98287db3 100644
--- a/tests/ui/parser/issues/issue-68730.stderr
+++ b/tests/ui/parser/issues/issue-68730.stderr
@@ -10,7 +10,7 @@ error: unknown start of token: \u{0}
   --> $DIR/issue-68730.rs:5:8
    |
 LL | enum␀em␀˂˂
-   |       ^
+   |        ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -18,30 +18,30 @@ error: unknown start of token: \u{2c2}
   --> $DIR/issue-68730.rs:5:9
    |
 LL | enum␀em␀˂˂
-   |       ^^
+   |         ^^
    |
    = note: character appears once more
 help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not
    |
 LL | enum␀em␀<<
-   |       ~~
+   |         ~~
 
 error: unknown start of token: \u{2c2}
   --> $DIR/issue-68730.rs:5:10
    |
 LL | enum␀em␀˂˂
-   |        ^
+   |          ^
    |
 help: Unicode character '˂' (Modifier Letter Left Arrowhead) looks like '<' (Less-Than Sign), but it is not
    |
 LL | enum␀em␀˂<
-   |        ~
+   |          ~
 
 error: expected one of `#`, `>`, `const`, identifier, or lifetime, found `<`
   --> $DIR/issue-68730.rs:5:10
    |
 LL | enum␀em␀˂˂
-   |        ^ expected one of `#`, `>`, `const`, identifier, or lifetime
+   |          ^ expected one of `#`, `>`, `const`, identifier, or lifetime
 
 error: aborting due to 5 previous errors
 
diff --git a/tests/ui/parser/issues/issue-81804.stderr b/tests/ui/parser/issues/issue-81804.stderr
index de3b33ecd95..6caaaa792b1 100644
--- a/tests/ui/parser/issues/issue-81804.stderr
+++ b/tests/ui/parser/issues/issue-81804.stderr
@@ -10,7 +10,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-81804.rs:6:11
    |
 LL | fn p([=(}
-   |     --    ^
+   |     --   ^
    |     ||
    |     |unclosed delimiter
    |     unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-81827.stderr b/tests/ui/parser/issues/issue-81827.stderr
index 63d135f73e6..d12c74b4a34 100644
--- a/tests/ui/parser/issues/issue-81827.stderr
+++ b/tests/ui/parser/issues/issue-81827.stderr
@@ -11,7 +11,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-81827.rs:10:27
    |
 LL | fn r()->i{0|{#[cfg(r(0{]0
-   |          -  -          -  ^
+   |          -  -          - ^
    |          |  |          |
    |          |  |          missing open `[` for this delimiter
    |          |  unclosed delimiter
diff --git a/tests/ui/parser/issues/issue-84104.stderr b/tests/ui/parser/issues/issue-84104.stderr
index e866d392267..b9b14c081a9 100644
--- a/tests/ui/parser/issues/issue-84104.stderr
+++ b/tests/ui/parser/issues/issue-84104.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-84104.rs:2:13
    |
 LL | #[i=i::<ښܖ<
-   |  -          ^
+   |  -         ^
    |  |
    |  unclosed delimiter
 
diff --git a/tests/ui/parser/issues/issue-84148-2.stderr b/tests/ui/parser/issues/issue-84148-2.stderr
index d9b6b336a2c..b30f3d9114c 100644
--- a/tests/ui/parser/issues/issue-84148-2.stderr
+++ b/tests/ui/parser/issues/issue-84148-2.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-84148-2.rs:2:16
    |
 LL | fn f(t:for<>t?
-   |     -          ^
+   |     -         ^
    |     |
    |     unclosed delimiter
 
diff --git a/tests/ui/parser/issues/issue-88770.stderr b/tests/ui/parser/issues/issue-88770.stderr
index 60ef025fa8b..5b54072d009 100644
--- a/tests/ui/parser/issues/issue-88770.stderr
+++ b/tests/ui/parser/issues/issue-88770.stderr
@@ -8,7 +8,7 @@ LL | fn m(){print!("",(c for&g
    |       unclosed delimiter
 ...
 LL | e
-   |   ^
+   |  ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
index 97aac661d46..39144246be2 100644
--- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
+++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.stderr
@@ -5,7 +5,7 @@ LL | impl T for () {
    |               - unclosed delimiter
 ...
 LL |
-   |                                                    ^
+   |                                                   ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr
index f70dac443e5..603aee02ad6 100644
--- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr
+++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-struct.stderr
@@ -5,7 +5,7 @@ LL | pub(crate) struct Bar<T> {
    |                          - unclosed delimiter
 ...
 LL | fn main() {}
-   |                                                                 ^
+   |                                                                ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
index a565ad49b22..a2fb698c80f 100644
--- a/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
+++ b/tests/ui/parser/mismatched-braces/missing-close-brace-in-trait.stderr
@@ -5,7 +5,7 @@ LL | trait T {
    |         - unclosed delimiter
 ...
 LL | fn main() {}
-   |                                                                 ^
+   |                                                                ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/parser-ice-ed2021-await-105210.stderr b/tests/ui/parser/parser-ice-ed2021-await-105210.stderr
index fc54476c220..29abab2608e 100644
--- a/tests/ui/parser/parser-ice-ed2021-await-105210.stderr
+++ b/tests/ui/parser/parser-ice-ed2021-await-105210.stderr
@@ -28,7 +28,7 @@ LL |  (( h (const {( default ( await ( await (    (move {await((((}}
    |  unclosed delimiter
 ...
 LL |
-   |                                                    ^
+   |                                                   ^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/parser/parser-recovery-1.stderr b/tests/ui/parser/parser-recovery-1.stderr
index 8162db3d8e5..4ed40d75326 100644
--- a/tests/ui/parser/parser-recovery-1.stderr
+++ b/tests/ui/parser/parser-recovery-1.stderr
@@ -10,7 +10,7 @@ LL | }
    | - ...as it matches this but it has different indentation
 ...
 LL | }
-   |                                                      ^
+   |                                                     ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr b/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr
index 3150570e1c9..e235a158384 100644
--- a/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr
+++ b/tests/ui/parser/several-carriage-returns-in-doc-comment.stderr
@@ -8,13 +8,13 @@ error: bare CR not allowed in doc-comment
   --> $DIR/several-carriage-returns-in-doc-comment.rs:6:32
    |
 LL | /// This do␍c comment contains ␍three isolated `\r`␍ symbols
-   |                               ^
+   |                                ^
 
 error: bare CR not allowed in doc-comment
   --> $DIR/several-carriage-returns-in-doc-comment.rs:6:52
    |
 LL | /// This do␍c comment contains ␍three isolated `\r`␍ symbols
-   |                                                  ^
+   |                                                    ^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr
index d40b982da7c..9fdad87a86c 100644
--- a/tests/ui/parser/unbalanced-doublequote.stderr
+++ b/tests/ui/parser/unbalanced-doublequote.stderr
@@ -3,7 +3,7 @@ error[E0765]: unterminated double quote string
    |
 LL | /     "
 LL | | }
-   | |__^
+   | |_^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/unclosed-braces.stderr b/tests/ui/parser/unclosed-braces.stderr
index acd92ac7925..74ac66af528 100644
--- a/tests/ui/parser/unclosed-braces.stderr
+++ b/tests/ui/parser/unclosed-braces.stderr
@@ -11,7 +11,7 @@ LL |     }
    |     - ...as it matches this but it has different indentation
 ...
 LL |
-   |                                                    ^
+   |                                                   ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr
index c6960892b2b..192f5324935 100644
--- a/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr
+++ b/tests/ui/parser/unmatched-delimiter-at-end-of-file.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:63
    |
 LL | fn foo() {
-   |          - unclosed delimiter                                 ^
+   |          - unclosed delimiter                                ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/use-unclosed-brace.stderr b/tests/ui/parser/use-unclosed-brace.stderr
index 6e624cb9131..1e62a0a06a3 100644
--- a/tests/ui/parser/use-unclosed-brace.stderr
+++ b/tests/ui/parser/use-unclosed-brace.stderr
@@ -5,7 +5,7 @@ LL | use foo::{bar, baz;
    |          - unclosed delimiter
 ...
 LL | fn main() {}
-   |              ^
+   |             ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/utf16-be-without-bom.stderr b/tests/ui/parser/utf16-be-without-bom.stderr
index 28cf6d97e96..55ebf7aacd2 100644
--- a/tests/ui/parser/utf16-be-without-bom.stderr
+++ b/tests/ui/parser/utf16-be-without-bom.stderr
@@ -10,7 +10,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:3
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |  ^
+   |   ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -18,7 +18,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:5
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |   ^
+   |     ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -26,7 +26,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:7
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |    ^
+   |       ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -34,7 +34,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:9
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |     ^
+   |         ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -42,7 +42,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:11
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |      ^
+   |           ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -50,7 +50,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:13
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |       ^
+   |             ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -58,7 +58,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:15
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |        ^
+   |               ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -66,7 +66,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:17
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |         ^
+   |                 ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -74,7 +74,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:19
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |          ^
+   |                   ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -82,7 +82,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:21
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |           ^
+   |                     ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -90,7 +90,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:23
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |            ^
+   |                       ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -98,7 +98,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-be-without-bom.rs:4:25
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |             ^
+   |                         ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -106,12 +106,12 @@ error: expected one of `!` or `::`, found `n`
   --> $DIR/utf16-be-without-bom.rs:4:4
    |
 LL | ␀f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |  ^ expected one of `!` or `::`
+   |    ^ expected one of `!` or `::`
    |
 help: consider removing the space to spell keyword `fn`
    |
 LL | ␀fn␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   | ~~
+   |  ~~
 
 error: aborting due to 14 previous errors
 
diff --git a/tests/ui/parser/utf16-le-without-bom.stderr b/tests/ui/parser/utf16-le-without-bom.stderr
index 53004ac942d..ad272a70f06 100644
--- a/tests/ui/parser/utf16-le-without-bom.stderr
+++ b/tests/ui/parser/utf16-le-without-bom.stderr
@@ -10,7 +10,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:4
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |   ^
+   |    ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -18,7 +18,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:6
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |    ^
+   |      ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -26,7 +26,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:8
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |     ^
+   |        ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -34,7 +34,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:10
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |      ^
+   |          ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -42,7 +42,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:12
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |       ^
+   |            ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -50,7 +50,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:14
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |        ^
+   |              ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -58,7 +58,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:16
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |         ^
+   |                ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -66,7 +66,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:18
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |          ^
+   |                  ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -74,7 +74,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:20
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |           ^
+   |                    ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -82,7 +82,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:22
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |            ^
+   |                      ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -90,7 +90,7 @@ error: unknown start of token: \u{0}
   --> $DIR/utf16-le-without-bom.rs:4:24
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |             ^
+   |                        ^
    |
    = help: source files must contain UTF-8 encoded text, unexpected null bytes might occur when a different encoding is used
 
@@ -106,7 +106,7 @@ error: expected one of `!` or `::`, found `n`
   --> $DIR/utf16-le-without-bom.rs:4:3
    |
 LL | f␀n␀ ␀m␀a␀i␀n␀(␀)␀ ␀{␀}␀
-   |  ^ expected one of `!` or `::`
+   |   ^ expected one of `!` or `::`
    |
 help: consider removing the space to spell keyword `fn`
    |
diff --git a/tests/ui/rustdoc/unterminated-doc-comment.stderr b/tests/ui/rustdoc/unterminated-doc-comment.stderr
index 2d96c606b16..f0b691333dc 100644
--- a/tests/ui/rustdoc/unterminated-doc-comment.stderr
+++ b/tests/ui/rustdoc/unterminated-doc-comment.stderr
@@ -2,7 +2,7 @@ error[E0758]: unterminated block doc-comment
   --> $DIR/unterminated-doc-comment.rs:1:1
    |
 LL | /*!
-   | ^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
index 004a057bbcd..c8cce162416 100644
--- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
+++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.stderr
@@ -2,7 +2,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/drop-location-span-error-rust-2021-incompatible-closure-captures-93117.rs:12:85
    |
 LL | trait C{async fn new(val: T) {}
-   |        - unclosed delimiter                                                         ^
+   |        - unclosed delimiter                                                        ^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/str/str-escape.stderr b/tests/ui/str/str-escape.stderr
index 599c8de9757..4c8ee6bc013 100644
--- a/tests/ui/str/str-escape.stderr
+++ b/tests/ui/str/str-escape.stderr
@@ -23,8 +23,8 @@ warning: whitespace symbol '\u{c}' is not skipped
 LL |       let s = b"a\
    |  ________________^
 LL | |     ␌b";
-   | |    ^- whitespace symbol '\u{c}' is not skipped
-   | |____|
+   | |     ^ whitespace symbol '\u{c}' is not skipped
+   | |_____|
    |
 
 warning: 3 warnings emitted
diff --git a/tests/ui/suggestions/issue-94171.stderr b/tests/ui/suggestions/issue-94171.stderr
index b3440e46e8a..3d73ee1d27a 100644
--- a/tests/ui/suggestions/issue-94171.stderr
+++ b/tests/ui/suggestions/issue-94171.stderr
@@ -30,7 +30,7 @@ LL | (; {`
    | unclosed delimiter
 ...
 LL |
-   |                                                    ^
+   |                                                   ^
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/typeck/issue-91334.stderr b/tests/ui/typeck/issue-91334.stderr
index 7cb30eea530..01e34919ce6 100644
--- a/tests/ui/typeck/issue-91334.stderr
+++ b/tests/ui/typeck/issue-91334.stderr
@@ -11,7 +11,7 @@ error: this file contains an unclosed delimiter
   --> $DIR/issue-91334.rs:7:23
    |
 LL | fn f(){||yield(((){),
-   |       -       -    -  ^
+   |       -       -    - ^
    |       |       |    |
    |       |       |    missing open `(` for this delimiter
    |       |       unclosed delimiter