Skip to content

Commit

Permalink
Add failing example for E0170 explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 14, 2020
1 parent bf84eb5 commit 5076a3e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/librustc_error_codes/error_codes/E0170.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
A pattern binding is using the same name as one of the variants a type.

Erroneous code example:

```compile_fail,E0170
# #![deny(warnings)]
enum Method {
GET,
POST,
}
fn is_empty(s: Method) -> bool {
match s {
GET => true,
_ => false
}
}
fn main() {}
```

Enum variants are qualified by default. For example, given this type:

```
Expand Down

0 comments on commit 5076a3e

Please sign in to comment.