about summary refs log tree commit diff
path: root/src/test/ui/empty
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-11 19:26:01 +0000
committerbors <bors@rust-lang.org>2021-08-11 19:26:01 +0000
commitccffcafd55e58f769d4b0efc0064bf65e76998e4 (patch)
tree725b619b120ee18a4bada33b6f7fb4385e06d6df /src/test/ui/empty
parent362e0f55eb1f36d279e5c4a58fb0fe5f9a2c579d (diff)
parent657caa5bf293e9d910a54dac10dc536e7c26e50b (diff)
Auto merge of #86532 - estebank:delete-suggestion-underline, r=petrochenkov
Make deleted code in a suggestion clearer

Show suggestions that include deletions in a way similar to `diff`'s output.

<img width="628" alt="" src="https://user-images.githubusercontent.com/1606434/123350316-9078e580-d50f-11eb-89b9-78431b85e23f.png">

For changes that do not have deletions, use `+` as an underline for additions and `~` as an underline for replacements.

<img width="631" alt="" src="https://user-images.githubusercontent.com/1606434/123701745-1ac68f80-d817-11eb-950b-09e5afd7532f.png">

For multiline suggestions, we now use `~` in the gutter to signal replacements and `+` to signal whole line replacements/additions.

<img width="834" alt="" src="https://user-images.githubusercontent.com/1606434/123701331-8eb46800-d816-11eb-9dcd-ef9098071afb.png">

In all cases we now use color to highlight the specific spans and snippets.
Diffstat (limited to 'src/test/ui/empty')
-rw-r--r--src/test/ui/empty/empty-struct-braces-expr.stderr16
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-1.stderr4
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-2.stderr16
-rw-r--r--src/test/ui/empty/empty-struct-braces-pat-3.stderr8
-rw-r--r--src/test/ui/empty/empty-struct-tuple-pat.stderr4
-rw-r--r--src/test/ui/empty/empty-struct-unit-expr.stderr4
-rw-r--r--src/test/ui/empty/empty-struct-unit-pat.stderr24
7 files changed, 38 insertions, 38 deletions
diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr
index 5ee8cbd912b..48e5ea8ec86 100644
--- a/src/test/ui/empty/empty-struct-braces-expr.stderr
+++ b/src/test/ui/empty/empty-struct-braces-expr.stderr
@@ -15,11 +15,11 @@ LL | pub struct XEmpty2;
 help: use struct literal syntax instead
    |
 LL |     let e1 = Empty1 {};
-   |              ^^^^^^^^^
+   |              ~~~~~~~~~
 help: a unit struct with a similar name exists
    |
 LL |     let e1 = XEmpty2;
-   |              ^^^^^^^
+   |              ~~~~~~~
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-expr.rs:16:14
@@ -38,11 +38,11 @@ LL | pub struct XEmpty2;
 help: use struct literal syntax instead
    |
 LL |     let e1 = Empty1 {};
-   |              ^^^^^^^^^
+   |              ~~~~~~~~~
 help: a unit struct with a similar name exists
    |
 LL |     let e1 = XEmpty2();
-   |              ^^^^^^^
+   |              ~~~~~~~
 
 error[E0423]: expected value, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-expr.rs:18:14
@@ -78,11 +78,11 @@ LL | pub struct XEmpty2;
 help: use struct literal syntax instead
    |
 LL |     let xe1 = XEmpty1 {};
-   |               ^^^^^^^^^^
+   |               ~~~~~~~~~~
 help: a unit struct with a similar name exists
    |
 LL |     let xe1 = XEmpty2;
-   |               ^^^^^^^
+   |               ~~~~~~~
 
 error[E0423]: expected function, tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-expr.rs:23:15
@@ -100,11 +100,11 @@ LL | pub struct XEmpty2;
 help: use struct literal syntax instead
    |
 LL |     let xe1 = XEmpty1 {};
-   |               ^^^^^^^^^^
+   |               ~~~~~~~~~~
 help: a unit struct with a similar name exists
    |
 LL |     let xe1 = XEmpty2();
-   |               ^^^^^^^
+   |               ~~~~~~~
 
 error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope
   --> $DIR/empty-struct-braces-expr.rs:25:19
diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.stderr b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
index 5c02b62969f..0215a9e5935 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-1.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
@@ -23,11 +23,11 @@ LL |     XEmpty4,
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: a unit variant with a similar name exists
    |
 LL |         XE::XEmpty4 => ()
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
index 4bac2dfe76f..28191615afd 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
@@ -15,11 +15,11 @@ LL | pub struct XEmpty6();
 help: use struct pattern syntax instead
    |
 LL |         Empty1 {} => ()
-   |         ^^^^^^^^^
+   |         ~~~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6() => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:18:9
@@ -38,11 +38,11 @@ LL | pub struct XEmpty6();
 help: use struct pattern syntax instead
    |
 LL |         XEmpty1 {} => ()
-   |         ^^^^^^^^^^
+   |         ~~~~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6() => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found struct `Empty1`
   --> $DIR/empty-struct-braces-pat-2.rs:21:9
@@ -61,11 +61,11 @@ LL | pub struct XEmpty6();
 help: use struct pattern syntax instead
    |
 LL |         Empty1 {} => ()
-   |         ^^^^^^^^^
+   |         ~~~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found struct `XEmpty1`
   --> $DIR/empty-struct-braces-pat-2.rs:24:9
@@ -84,11 +84,11 @@ LL | pub struct XEmpty6();
 help: use struct pattern syntax instead
    |
 LL |         XEmpty1 {} => ()
-   |         ^^^^^^^^^^
+   |         ~~~~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.stderr b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
index cc2feb86d8e..60266bb3580 100644
--- a/src/test/ui/empty/empty-struct-braces-pat-3.stderr
+++ b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
@@ -24,11 +24,11 @@ LL |     XEmpty5(),
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: a tuple variant with a similar name exists
    |
 LL |         XE::XEmpty5() => ()
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found struct variant `E::Empty3`
   --> $DIR/empty-struct-braces-pat-3.rs:25:9
@@ -56,11 +56,11 @@ LL |     XEmpty5(),
 help: use struct pattern syntax instead
    |
 LL |         XE::XEmpty3 { /* fields */ } => ()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: a tuple variant with a similar name exists
    |
 LL |         XE::XEmpty5(..) => ()
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr
index 9b5c8422de5..e696b85c6cc 100644
--- a/src/test/ui/empty/empty-struct-tuple-pat.stderr
+++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr
@@ -41,11 +41,11 @@ LL |     XEmpty5(),
 help: use the tuple variant pattern syntax instead
    |
 LL |         XE::XEmpty5(/* fields */) => (),
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |         ~~~~~~~~~~~~~~~~~~~~~~~~~
 help: a unit variant with a similar name exists
    |
 LL |         XE::XEmpty4 => (),
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr
index 50b0e19133e..1023950639a 100644
--- a/src/test/ui/empty/empty-struct-unit-expr.stderr
+++ b/src/test/ui/empty/empty-struct-unit-expr.stderr
@@ -23,7 +23,7 @@ LL |     let e4 = E::Empty4();
 help: `E::Empty4` is a unit variant, you need to write it without the parenthesis
    |
 LL |     let e4 = E::Empty4;
-   |              ^^^^^^^^^
+   |              ~~~~~~~~~
 
 error[E0618]: expected function, found `empty_struct::XEmpty2`
   --> $DIR/empty-struct-unit-expr.rs:18:15
@@ -44,7 +44,7 @@ LL |     let xe4 = XE::XEmpty4();
 help: `XE::XEmpty4` is a unit variant, you need to write it without the parenthesis
    |
 LL |     let xe4 = XE::XEmpty4;
-   |               ^^^^^^^^^^^
+   |               ~~~~~~~~~~~
 
 error: aborting due to 4 previous errors
 
diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr
index 839d3a84103..b1b253385fd 100644
--- a/src/test/ui/empty/empty-struct-unit-pat.stderr
+++ b/src/test/ui/empty/empty-struct-unit-pat.stderr
@@ -15,11 +15,11 @@ LL | pub struct XEmpty6();
 help: use this syntax instead
    |
 LL |         Empty2 => ()
-   |         ^^^^^^
+   |         ~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6() => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
   --> $DIR/empty-struct-unit-pat.rs:24:9
@@ -37,11 +37,11 @@ LL | pub struct XEmpty6();
 help: use this syntax instead
    |
 LL |         XEmpty2 => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6() => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `Empty2`
   --> $DIR/empty-struct-unit-pat.rs:28:9
@@ -60,11 +60,11 @@ LL | pub struct XEmpty6();
 help: use this syntax instead
    |
 LL |         Empty2 => ()
-   |         ^^^^^^
+   |         ~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found unit struct `XEmpty2`
   --> $DIR/empty-struct-unit-pat.rs:32:9
@@ -82,11 +82,11 @@ LL | pub struct XEmpty6();
 help: use this syntax instead
    |
 LL |         XEmpty2 => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 help: a tuple struct with a similar name exists
    |
 LL |         XEmpty6(..) => ()
-   |         ^^^^^^^
+   |         ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
   --> $DIR/empty-struct-unit-pat.rs:37:9
@@ -113,11 +113,11 @@ LL |     XEmpty5(),
 help: use this syntax instead
    |
 LL |         XE::XEmpty4 => (),
-   |         ^^^^^^^^^^^
+   |         ~~~~~~~~~~~
 help: a tuple variant with a similar name exists
    |
 LL |         XE::XEmpty5() => (),
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error[E0532]: expected tuple struct or tuple variant, found unit variant `E::Empty4`
   --> $DIR/empty-struct-unit-pat.rs:46:9
@@ -144,11 +144,11 @@ LL |     XEmpty5(),
 help: use this syntax instead
    |
 LL |         XE::XEmpty4 => (),
-   |         ^^^^^^^^^^^
+   |         ~~~~~~~~~~~
 help: a tuple variant with a similar name exists
    |
 LL |         XE::XEmpty5(..) => (),
-   |             ^^^^^^^
+   |             ~~~~~~~
 
 error: aborting due to 8 previous errors