Fix #64744 -- handle zero sub-pats case.
This commit is contained in:
parent
6ef275e6c3
commit
7b71abdb54
3 changed files with 62 additions and 15 deletions
|
|
@ -2,9 +2,9 @@ enum Fruit {
|
|||
Apple(String, String),
|
||||
Pear(u32),
|
||||
Orange((String, String)),
|
||||
Banana(()),
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = Fruit::Apple(String::new(), String::new());
|
||||
match x {
|
||||
|
|
@ -12,5 +12,6 @@ fn main() {
|
|||
Fruit::Apple(a, b, c) => {}, //~ ERROR E0023
|
||||
Fruit::Pear(1, 2) => {}, //~ ERROR E0023
|
||||
Fruit::Orange(a, b) => {}, //~ ERROR E0023
|
||||
Fruit::Banana() => {}, //~ ERROR E0023
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,19 @@ help: missing parenthesis
|
|||
LL | Fruit::Orange((a, b)) => {},
|
||||
| ^ ^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 1 field
|
||||
--> $DIR/E0023.rs:15:9
|
||||
|
|
||||
LL | Banana(()),
|
||||
| ---------- tuple variant defined here
|
||||
...
|
||||
LL | Fruit::Banana() => {},
|
||||
| ^^^^^^^^^^^^^^^ expected 1 field, found 0
|
||||
help: missing parenthesis
|
||||
|
|
||||
LL | Fruit::Banana(()) => {},
|
||||
| ^ ^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0023`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue