about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2021-01-12 20:39:51 -0800
committerCamelid <camelidcamel@gmail.com>2021-01-12 21:20:26 -0800
commite8c87935e0004ff784ad361a5bac39d7677c3f4f (patch)
tree28f56651a645677f5fd94998b561767b653a2e19 /src/test/ui/pattern
parentd7307a71f5e1893f7bd69ff160ce38dc97b5d195 (diff)
downloadrust-e8c87935e0004ff784ad361a5bac39d7677c3f4f.tar.gz
rust-e8c87935e0004ff784ad361a5bac39d7677c3f4f.zip
Include `..` suggestion if fields are all wildcards
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/pat-tuple-underfield.rs2
-rw-r--r--src/test/ui/pattern/pat-tuple-underfield.stderr20
2 files changed, 16 insertions, 6 deletions
diff --git a/src/test/ui/pattern/pat-tuple-underfield.rs b/src/test/ui/pattern/pat-tuple-underfield.rs
index 50f8a855d36..ed852a47bb4 100644
--- a/src/test/ui/pattern/pat-tuple-underfield.rs
+++ b/src/test/ui/pattern/pat-tuple-underfield.rs
@@ -14,6 +14,7 @@ fn main() {
         S(_) => {}
         //~^ ERROR this pattern has 1 field, but the corresponding tuple struct has 2 fields
         //~| HELP use `_` to explicitly ignore each field
+        //~| HELP use `..` to ignore all fields
     }
     match S(0, 1.0) {
         S() => {}
@@ -31,6 +32,7 @@ fn main() {
         E::S(_) => {}
         //~^ ERROR this pattern has 1 field, but the corresponding tuple variant has 2 fields
         //~| HELP use `_` to explicitly ignore each field
+        //~| HELP use `..` to ignore all fields
     }
     match E::S(0, 1.0) {
         E::S() => {}
diff --git a/src/test/ui/pattern/pat-tuple-underfield.stderr b/src/test/ui/pattern/pat-tuple-underfield.stderr
index cdf7cfe3005..76323d9a7bf 100644
--- a/src/test/ui/pattern/pat-tuple-underfield.stderr
+++ b/src/test/ui/pattern/pat-tuple-underfield.stderr
@@ -1,5 +1,5 @@
 error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::S`
-  --> $DIR/pat-tuple-underfield.rs:42:9
+  --> $DIR/pat-tuple-underfield.rs:44:9
    |
 LL |     S(i32, f32),
    |     ----------- `E::S` defined here
@@ -34,9 +34,13 @@ help: use `_` to explicitly ignore each field
    |
 LL |         S(_, _) => {}
    |            ^^^
+help: use `..` to ignore all fields
+   |
+LL |         S(..) => {}
+   |           ^^
 
 error[E0023]: this pattern has 0 fields, but the corresponding tuple struct has 2 fields
-  --> $DIR/pat-tuple-underfield.rs:19:9
+  --> $DIR/pat-tuple-underfield.rs:20:9
    |
 LL | struct S(i32, f32);
    | ------------------- tuple struct defined here
@@ -54,7 +58,7 @@ LL |         S(..) => {}
    |           ^^
 
 error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
-  --> $DIR/pat-tuple-underfield.rs:26:9
+  --> $DIR/pat-tuple-underfield.rs:27:9
    |
 LL |     S(i32, f32),
    |     ----------- tuple variant defined here
@@ -68,7 +72,7 @@ LL |         E::S(x, _) => {}
    |               ^^^
 
 error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields
-  --> $DIR/pat-tuple-underfield.rs:31:9
+  --> $DIR/pat-tuple-underfield.rs:32:9
    |
 LL |     S(i32, f32),
    |     ----------- tuple variant defined here
@@ -80,9 +84,13 @@ help: use `_` to explicitly ignore each field
    |
 LL |         E::S(_, _) => {}
    |               ^^^
+help: use `..` to ignore all fields
+   |
+LL |         E::S(..) => {}
+   |              ^^
 
 error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 2 fields
-  --> $DIR/pat-tuple-underfield.rs:36:9
+  --> $DIR/pat-tuple-underfield.rs:38:9
    |
 LL |     S(i32, f32),
    |     ----------- tuple variant defined here
@@ -100,7 +108,7 @@ LL |         E::S(..) => {}
    |              ^^
 
 error[E0023]: this pattern has 2 fields, but the corresponding tuple struct has 4 fields
-  --> $DIR/pat-tuple-underfield.rs:48:9
+  --> $DIR/pat-tuple-underfield.rs:50:9
    |
 LL | struct Point4(i32, i32, i32, i32);
    | ---------------------------------- tuple struct defined here