about summary refs log tree commit diff
path: root/src/test/ui/missing
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/missing
parent362e0f55eb1f36d279e5c4a58fb0fe5f9a2c579d (diff)
parent657caa5bf293e9d910a54dac10dc536e7c26e50b (diff)
downloadrust-ccffcafd55e58f769d4b0efc0064bf65e76998e4.tar.gz
rust-ccffcafd55e58f769d4b0efc0064bf65e76998e4.zip
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/missing')
-rw-r--r--src/test/ui/missing/missing-fields-in-struct-pattern.stderr2
-rw-r--r--src/test/ui/missing/missing-items/missing-type-parameter2.stderr24
2 files changed, 13 insertions, 13 deletions
diff --git a/src/test/ui/missing/missing-fields-in-struct-pattern.stderr b/src/test/ui/missing/missing-fields-in-struct-pattern.stderr
index a95b5bb94d2..1fe9f5299aa 100644
--- a/src/test/ui/missing/missing-fields-in-struct-pattern.stderr
+++ b/src/test/ui/missing/missing-fields-in-struct-pattern.stderr
@@ -7,7 +7,7 @@ LL |     if let S { a, b, c, d } = S(1, 2, 3, 4) {
 help: use the tuple variant pattern syntax instead
    |
 LL |     if let S(a, b, c, d) = S(1, 2, 3, 4) {
-   |             ^^^^^^^^^^^^
+   |             ~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr
index 985a9bb2a3f..f955659f23d 100644
--- a/src/test/ui/missing/missing-items/missing-type-parameter2.stderr
+++ b/src/test/ui/missing/missing-items/missing-type-parameter2.stderr
@@ -10,11 +10,11 @@ LL | impl X<N> {}
 help: a struct with a similar name exists
    |
 LL | impl X<X> {}
-   |        ^
+   |        ~
 help: you might be missing a type parameter
    |
 LL | impl<N> X<N> {}
-   |     ^^^
+   |     +++
 
 error[E0412]: cannot find type `N` in this scope
   --> $DIR/missing-type-parameter2.rs:9:28
@@ -27,11 +27,11 @@ LL | impl<T, const A: u8 = 2> X<N> {}
 help: a type parameter with a similar name exists
    |
 LL | impl<T, const A: u8 = 2> X<T> {}
-   |                            ^
+   |                            ~
 help: you might be missing a type parameter
    |
 LL | impl<T, const A: u8 = 2, N> X<N> {}
-   |                        ^^^
+   |                        +++
 
 error[E0412]: cannot find type `T` in this scope
   --> $DIR/missing-type-parameter2.rs:14:20
@@ -45,11 +45,11 @@ LL | fn foo(_: T) where T: Send {}
 help: a struct with a similar name exists
    |
 LL | fn foo(_: T) where X: Send {}
-   |                    ^
+   |                    ~
 help: you might be missing a type parameter
    |
 LL | fn foo<T>(_: T) where T: Send {}
-   |       ^^^
+   |       +++
 
 error[E0412]: cannot find type `T` in this scope
   --> $DIR/missing-type-parameter2.rs:14:11
@@ -63,11 +63,11 @@ LL | fn foo(_: T) where T: Send {}
 help: a struct with a similar name exists
    |
 LL | fn foo(_: X) where T: Send {}
-   |           ^
+   |           ~
 help: you might be missing a type parameter
    |
 LL | fn foo<T>(_: T) where T: Send {}
-   |       ^^^
+   |       +++
 
 error[E0412]: cannot find type `A` in this scope
   --> $DIR/missing-type-parameter2.rs:18:24
@@ -81,11 +81,11 @@ LL | fn bar<const N: u8>(_: A) {}
 help: a struct with a similar name exists
    |
 LL | fn bar<const N: u8>(_: X) {}
-   |                        ^
+   |                        ~
 help: you might be missing a type parameter
    |
 LL | fn bar<const N: u8, A>(_: A) {}
-   |                   ^^^
+   |                   +++
 
 error[E0747]: unresolved item provided when a constant was expected
   --> $DIR/missing-type-parameter2.rs:6:8
@@ -96,7 +96,7 @@ LL | impl X<N> {}
 help: if this generic argument was intended as a const parameter, surround it with braces
    |
 LL | impl X<{ N }> {}
-   |        ^   ^
+   |        +   +
 
 error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
   --> $DIR/missing-type-parameter2.rs:9:15
@@ -113,7 +113,7 @@ LL | impl<T, const A: u8 = 2> X<N> {}
 help: if this generic argument was intended as a const parameter, surround it with braces
    |
 LL | impl<T, const A: u8 = 2> X<{ N }> {}
-   |                            ^   ^
+   |                            +   +
 
 error: aborting due to 8 previous errors