diff options
| author | Sam Radhakrishan <sk09idm@gmail.com> | 2019-09-19 22:12:05 +0530 |
|---|---|---|
| committer | Sam Radhakrishan <sk09idm@gmail.com> | 2019-09-22 00:00:34 +0530 |
| commit | a2a57bc6cf383fc113335148296c7965bb29e9a2 (patch) | |
| tree | c5e2b826eb82e1c883499142663ccc372435d9aa /src/test/ui/error-codes | |
| parent | ed8b708c1a6bf6d94f860eeb6a6b0b442c380d7f (diff) | |
| download | rust-a2a57bc6cf383fc113335148296c7965bb29e9a2.tar.gz rust-a2a57bc6cf383fc113335148296c7965bb29e9a2.zip | |
Fixes #63962. Hint about missing tuple parentheses in patterns
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0023.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0023.stderr | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/test/ui/error-codes/E0023.rs b/src/test/ui/error-codes/E0023.rs index 2a97e9048a4..dc421e060e8 100644 --- a/src/test/ui/error-codes/E0023.rs +++ b/src/test/ui/error-codes/E0023.rs @@ -1,6 +1,7 @@ enum Fruit { Apple(String, String), Pear(u32), + Orange((String, String)), } @@ -10,5 +11,6 @@ fn main() { Fruit::Apple(a) => {}, //~ ERROR E0023 Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 Fruit::Pear(1, 2) => {}, //~ ERROR E0023 + Fruit::Orange(a, b) => {}, //~ ERROR E0023 } } diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr index d04e494c258..8ae7d01ed5f 100644 --- a/src/test/ui/error-codes/E0023.stderr +++ b/src/test/ui/error-codes/E0023.stderr @@ -1,5 +1,5 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields - --> $DIR/E0023.rs:10:9 + --> $DIR/E0023.rs:11:9 | LL | Apple(String, String), | --------------------- tuple variant defined here @@ -8,7 +8,7 @@ LL | Fruit::Apple(a) => {}, | ^^^^^^^^^^^^^^^ expected 2 fields, found 1 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields - --> $DIR/E0023.rs:11:9 + --> $DIR/E0023.rs:12:9 | LL | Apple(String, String), | --------------------- tuple variant defined here @@ -17,7 +17,7 @@ LL | Fruit::Apple(a, b, c) => {}, | ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field - --> $DIR/E0023.rs:12:9 + --> $DIR/E0023.rs:13:9 | LL | Pear(u32), | --------- tuple variant defined here @@ -25,6 +25,19 @@ LL | Pear(u32), LL | Fruit::Pear(1, 2) => {}, | ^^^^^^^^^^^^^^^^^ expected 1 field, found 2 -error: aborting due to 3 previous errors +error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field + --> $DIR/E0023.rs:14:9 + | +LL | Orange((String, String)), + | ------------------------ tuple variant defined here +... +LL | Fruit::Orange(a, b) => {}, + | ^^^^^^^^^^^^^^^^^^^ expected 1 field, found 2 +help: missing parenthesis + | +LL | Fruit::Orange((a, b)) => {}, + | ^ ^ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0023`. |
