about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2021-01-26 11:24:43 -0800
committerEsteban Küber <esteban@kuber.com.ar>2021-01-26 11:27:53 -0800
commit0959f0f912c1029f0dfd3de431786433211a1f2d (patch)
tree7e3b8585ca59f3c85270f3340aac37feb7dd2828 /src/test/ui
parent7907345e58b4f4d2c95e5ea9b8e0b3bff8946523 (diff)
downloadrust-0959f0f912c1029f0dfd3de431786433211a1f2d.tar.gz
rust-0959f0f912c1029f0dfd3de431786433211a1f2d.zip
Tweak suggestion for missing field in patterns
Account for parser recovered struct and tuple patterns to avoid invalid
suggestion.

Follow up to #81103.
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/destructuring-assignment/struct_destructure_fail.stderr8
-rw-r--r--src/test/ui/error-codes/E0027.stderr12
-rw-r--r--src/test/ui/structs/struct-pat-derived-error.stderr4
3 files changed, 12 insertions, 12 deletions
diff --git a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
index c0955ef8b06..8a83e145ea2 100644
--- a/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
+++ b/src/test/ui/destructuring-assignment/struct_destructure_fail.stderr
@@ -32,12 +32,12 @@ LL |     Struct { a, _ } = Struct { a: 1, b: 2 };
    |
 help: include the missing field in the pattern
    |
-LL |     Struct { a, b _ } = Struct { a: 1, b: 2 };
-   |               ^^^
+LL |     Struct { a, b } = Struct { a: 1, b: 2 };
+   |               ^^^^^
 help: if you don't care about this missing field, you can explicitly ignore it
    |
-LL |     Struct { a, .. _ } = Struct { a: 1, b: 2 };
-   |               ^^^^
+LL |     Struct { a, .. } = Struct { a: 1, b: 2 };
+   |               ^^^^^^
 
 error: aborting due to 5 previous errors
 
diff --git a/src/test/ui/error-codes/E0027.stderr b/src/test/ui/error-codes/E0027.stderr
index 694bbc358fe..a3dd6910be4 100644
--- a/src/test/ui/error-codes/E0027.stderr
+++ b/src/test/ui/error-codes/E0027.stderr
@@ -7,11 +7,11 @@ LL |         Dog { age: x } => {}
 help: include the missing field in the pattern
    |
 LL |         Dog { age: x, name } => {}
-   |                     ^^^^^^
+   |                     ^^^^^^^^
 help: if you don't care about this missing field, you can explicitly ignore it
    |
 LL |         Dog { age: x, .. } => {}
-   |                     ^^^^
+   |                     ^^^^^^
 
 error[E0027]: pattern does not mention field `age`
   --> $DIR/E0027.rs:15:9
@@ -22,11 +22,11 @@ LL |         Dog { name: x, } => {}
 help: include the missing field in the pattern
    |
 LL |         Dog { name: x, age } => {}
-   |                      ^^^^^
+   |                      ^^^^^^^
 help: if you don't care about this missing field, you can explicitly ignore it
    |
 LL |         Dog { name: x, .. } => {}
-   |                      ^^^^
+   |                      ^^^^^^
 
 error[E0027]: pattern does not mention field `age`
   --> $DIR/E0027.rs:19:9
@@ -37,11 +37,11 @@ LL |         Dog { name: x  , } => {}
 help: include the missing field in the pattern
    |
 LL |         Dog { name: x, age } => {}
-   |                      ^^^^^
+   |                      ^^^^^^^
 help: if you don't care about this missing field, you can explicitly ignore it
    |
 LL |         Dog { name: x, .. } => {}
-   |                      ^^^^
+   |                      ^^^^^^
 
 error[E0027]: pattern does not mention fields `name`, `age`
   --> $DIR/E0027.rs:22:9
diff --git a/src/test/ui/structs/struct-pat-derived-error.stderr b/src/test/ui/structs/struct-pat-derived-error.stderr
index 921d060faa3..c1a95636d34 100644
--- a/src/test/ui/structs/struct-pat-derived-error.stderr
+++ b/src/test/ui/structs/struct-pat-derived-error.stderr
@@ -19,11 +19,11 @@ LL |         let A { x, y } = self.d;
 help: include the missing fields in the pattern
    |
 LL |         let A { x, y, b, c } = self.d;
-   |                     ^^^^^^
+   |                     ^^^^^^^^
 help: if you don't care about these missing fields, you can explicitly ignore them
    |
 LL |         let A { x, y, .. } = self.d;
-   |                     ^^^^
+   |                     ^^^^^^
 
 error: aborting due to 3 previous errors