]> git.proxmox.com Git - rustc.git/blame - src/librustc_error_codes/error_codes/E0164.md
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0164.md
CommitLineData
dfeec247
XL
1Something which is neither a tuple struct nor a tuple variant was used as a
2pattern.
3
4Erroneous code example:
60c5eb7d
XL
5
6```compile_fail,E0164
dfeec247
XL
7enum A {
8 B,
9 C,
10}
11
12impl A {
13 fn new() {}
14}
60c5eb7d 15
dfeec247 16fn bar(foo: A) {
60c5eb7d 17 match foo {
dfeec247
XL
18 A::new() => (), // error!
19 _ => {}
60c5eb7d
XL
20 }
21}
22```
23
dfeec247
XL
24This error means that an attempt was made to match something which is neither a
25tuple struct nor a tuple variant. Only these two elements are allowed as a
26pattern:
60c5eb7d
XL
27
28```
dfeec247
XL
29enum A {
30 B,
31 C,
32}
33
34impl A {
35 fn new() {}
36}
60c5eb7d 37
dfeec247 38fn bar(foo: A) {
60c5eb7d 39 match foo {
dfeec247
XL
40 A::B => (), // ok!
41 _ => {}
60c5eb7d
XL
42 }
43}
44```