Skip to content

Commit 60d9c2c

Browse files
Improve E0023 long error explanation
1 parent ea62c2e commit 60d9c2c

File tree

1 file changed

+8
-1
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+8
-1
lines changed

src/librustc_error_codes/error_codes/E0023.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ A pattern attempted to extract an incorrect number of fields from a variant.
22

33
Erroneous code example:
44

5-
```
5+
```compile_fail,E0023
66
enum Fruit {
77
Apple(String, String),
88
Pear(u32),
99
}
10+
11+
let x = Fruit::Apple(String::new(), String::new());
12+
13+
match x {
14+
Fruit::Apple(a) => {}, // error!
15+
_ => {}
16+
}
1017
```
1118

1219
A pattern used to match against an enum variant must provide a sub-pattern for

0 commit comments

Comments
 (0)