From f1c751bc1a08e3439a9d0c482cbb0ea0fc8f644f Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Thu, 27 Feb 2025 21:12:58 +0000 Subject: Refactor `emitter` to better account for unicode chars when trimming Change the way that underline positions are calculated by delaying using the "visual" column position until the last possible moment, instead using the "file"/byte position in the file, and then calculating visual positioning as late as possible. This should make the underlines more resilient to non-1-width unicode chars. Unfortunately, as part of this change (which fixes some visual bugs) comes with the loss of some eager tab codepoint handling, but the output remains legible despite some minor regression on the "margin trimming" logic. --- tests/ui/parser/byte-string-literals.stderr | 2 +- tests/ui/parser/raw/too-many-hash.stderr | 2 +- tests/ui/parser/unbalanced-doublequote.stderr | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/ui/parser') diff --git a/tests/ui/parser/byte-string-literals.stderr b/tests/ui/parser/byte-string-literals.stderr index 08633742557..3e589258d41 100644 --- a/tests/ui/parser/byte-string-literals.stderr +++ b/tests/ui/parser/byte-string-literals.stderr @@ -44,7 +44,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/raw/too-many-hash.stderr b/tests/ui/parser/raw/too-many-hash.stderr index 61fcbcee159..0be85872008 100644 --- a/tests/ui/parser/raw/too-many-hash.stderr +++ b/tests/ui/parser/raw/too-many-hash.stderr @@ -1,7 +1,7 @@ error: too many `#` symbols: raw strings may be delimited by up to 255 `#` symbols, but found 256 --> $DIR/too-many-hash.rs:4:19 | -LL | ... = r############################################################################...#############################################################... +LL | ... = r############################################################################...###############################################################; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/parser/unbalanced-doublequote.stderr b/tests/ui/parser/unbalanced-doublequote.stderr index 9fdad87a86c..d40b982da7c 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 -- cgit 1.4.1-3-g733a5