Skip to content

Commit

Permalink
Clean up E0081 long explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 27, 2019
1 parent 38f9cd4 commit ce69610
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/librustc_error_codes/error_codes/E0081.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
Enum discriminants are used to differentiate enum variants stored in memory.
This error indicates that the same value was used for two or more variants,
making them impossible to tell apart.
A discrimant value is present more than once.

Erroneous code example:

```compile_fail,E0081
// Bad.
enum Enum {
P = 3,
X = 3,
X = 3, // error!
Y = 5,
}
```

Enum discriminants are used to differentiate enum variants stored in memory.
This error indicates that the same value was used for two or more variants,
making it impossible to distinguish them.

```
// Good.
enum Enum {
P,
X = 3,
X = 3, // ok!
Y = 5,
}
```
Expand All @@ -27,7 +29,7 @@ variants.
```compile_fail,E0081
enum Bad {
X,
Y = 0
Y = 0, // error!
}
```

Expand Down

0 comments on commit ce69610

Please sign in to comment.