about summary refs log tree commit diff
path: root/src/test/ui/error-codes
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-07-09 17:42:07 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-07-14 10:41:44 -0700
commit04298204ed17eeed4d23aaa45fb0db9336e6583c (patch)
treee52cebc732d07e32a77fe2aeca4ca6661f235502 /src/test/ui/error-codes
parent346aec9b02f3c74f3fce97fd6bda24709d220e49 (diff)
downloadrust-04298204ed17eeed4d23aaa45fb0db9336e6583c.tar.gz
rust-04298204ed17eeed4d23aaa45fb0db9336e6583c.zip
Suggest struct pat on incorrect unit or tuple pat
When encountering a unit or tuple pattern for a struct-like item, suggest
using the correct pattern.

Use `insert_field_names_local` when evaluating variants and store field
names even when the list is empty in order to produce accurate
structured suggestions.
Diffstat (limited to 'src/test/ui/error-codes')
-rw-r--r--src/test/ui/error-codes/E0423.stderr15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr
index d4860394259..077367de9d8 100644
--- a/src/test/ui/error-codes/E0423.stderr
+++ b/src/test/ui/error-codes/E0423.stderr
@@ -33,13 +33,16 @@ LL |     struct Foo { a: bool };
    |     ---------------------- `Foo` defined here
 LL | 
 LL |     let f = Foo();
+   |             ^^^^^
+   |
+help: a function with a similar name exists
+   |
+LL |     let f = foo();
    |             ^^^
-   |             |
-   |             did you mean `Foo { /* fields */ }`?
-   |             help: a function with a similar name exists (notice the capitalization): `foo`
-...
-LL | fn foo() {
-   | -------- similarly named function `foo` defined here
+help: use struct literal syntax instead
+   |
+LL |     let f = Foo { a: val };
+   |             ^^^^^^^^^^^^^^
 
 error[E0423]: expected value, found struct `T`
   --> $DIR/E0423.rs:14:8