about summary refs log tree commit diff
path: root/tests/ui/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-21 23:59:08 +0000
committerbors <bors@rust-lang.org>2025-02-21 23:59:08 +0000
commitdc37ff82e861428d537ae28e7b92296c4583fb5a (patch)
treed58f3fd3708a8a6045c12e6fb9f22a24afd811be /tests/ui/parser
parent794c12416b2138064af1f2746646973fafd9419d (diff)
parent160905b6253f42967ed4aef4b98002944c7df24c (diff)
Auto merge of #137348 - compiler-errors:span-trim, r=estebank
More sophisticated span trimming for suggestions

Previously #136958 only cared about prefixes or suffixes. Now it detects more cases where a suggestion is "sandwiched" by unchanged code on the left or the right. Would be cool if we could detect several insertions, like `ACE` going to `ABCDE`, extracting `B` and `D`, but that seems unwieldy.

r? `@estebank`
Diffstat (limited to 'tests/ui/parser')
-rw-r--r--tests/ui/parser/emoji-identifiers.stderr5
-rw-r--r--tests/ui/parser/extern-crate-unexpected-token.stderr5
-rw-r--r--tests/ui/parser/misspelled-keywords/const-fn.stderr5
3 files changed, 6 insertions, 9 deletions
diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr
index f0e90082bff..ef4e647b9f5 100644
--- a/tests/ui/parser/emoji-identifiers.stderr
+++ b/tests/ui/parser/emoji-identifiers.stderr
@@ -81,9 +81,8 @@ LL |     fn full_of_โœจ() -> ๐Ÿ‘€ {
    |     ^^^^^^^^^^^^^^^^^^^^^
 help: there is an associated function `full_of_โœจ` with a similar name
    |
-LL -     ๐Ÿ‘€::full_ofโœจ()
-LL +     ๐Ÿ‘€::full_of_โœจ()
-   |
+LL |     ๐Ÿ‘€::full_of_โœจ()
+   |                +
 
 error[E0425]: cannot find function `i_like_to_๐Ÿ˜„_a_lot` in this scope
   --> $DIR/emoji-identifiers.rs:13:13
diff --git a/tests/ui/parser/extern-crate-unexpected-token.stderr b/tests/ui/parser/extern-crate-unexpected-token.stderr
index 3d48f0adfa1..033db85a6c7 100644
--- a/tests/ui/parser/extern-crate-unexpected-token.stderr
+++ b/tests/ui/parser/extern-crate-unexpected-token.stderr
@@ -6,9 +6,8 @@ LL | extern crte foo;
    |
 help: there is a keyword `crate` with a similar name
    |
-LL - extern crte foo;
-LL + extern crate foo;
-   |
+LL | extern crate foo;
+   |          +
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/parser/misspelled-keywords/const-fn.stderr b/tests/ui/parser/misspelled-keywords/const-fn.stderr
index 46a6d8ca779..cc4c0f92917 100644
--- a/tests/ui/parser/misspelled-keywords/const-fn.stderr
+++ b/tests/ui/parser/misspelled-keywords/const-fn.stderr
@@ -6,9 +6,8 @@ LL | cnst fn code() {}
    |
 help: there is a keyword `const` with a similar name
    |
-LL - cnst fn code() {}
-LL + const fn code() {}
-   |
+LL | const fn code() {}
+   |  +
 
 error: aborting due to 1 previous error