Improve E0023 long error explanation
This commit is contained in:
parent
ea62c2e5b3
commit
60d9c2c239
1 changed files with 8 additions and 1 deletions
|
|
@ -2,11 +2,18 @@ A pattern attempted to extract an incorrect number of fields from a variant.
|
|||
|
||||
Erroneous code example:
|
||||
|
||||
```
|
||||
```compile_fail,E0023
|
||||
enum Fruit {
|
||||
Apple(String, String),
|
||||
Pear(u32),
|
||||
}
|
||||
|
||||
let x = Fruit::Apple(String::new(), String::new());
|
||||
|
||||
match x {
|
||||
Fruit::Apple(a) => {}, // error!
|
||||
_ => {}
|
||||
}
|
||||
```
|
||||
|
||||
A pattern used to match against an enum variant must provide a sub-pattern for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue