Skip to content

Commit 65061c1

Browse files
Add back the E0024 error code long explanation
1 parent 7d611fc commit 65061c1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/librustc_error_codes/error_codes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ E0019: include_str!("./error_codes/E0019.md"),
2828
E0020: include_str!("./error_codes/E0020.md"),
2929
E0022: include_str!("./error_codes/E0022.md"),
3030
E0023: include_str!("./error_codes/E0023.md"),
31+
E0024: include_str!("./error_codes/E0024.md"),
3132
E0025: include_str!("./error_codes/E0025.md"),
3233
E0026: include_str!("./error_codes/E0026.md"),
3334
E0027: include_str!("./error_codes/E0027.md"),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#### Note: this error code is no longer emitted by the compiler.
2+
3+
This error indicates that a pattern attempted to extract the fields of an enum
4+
variant with no fields. Here's a tiny example of this error:
5+
6+
```compile_fail,E0532
7+
// This enum has two variants.
8+
enum Number {
9+
// This variant has no fields.
10+
Zero,
11+
// This variant has one field.
12+
One(u32)
13+
}
14+
15+
// Assuming x is a Number we can pattern match on its contents.
16+
match Number::Zero {
17+
Number::Zero(inside) => {}
18+
Number::One(inside) => {}
19+
}
20+
```
21+
22+
The pattern match `Zero(inside)` is incorrect because the `Zero` variant
23+
contains no fields, yet the `inside` name attempts to bind the first field of
24+
the enum.

0 commit comments

Comments
 (0)