Rollup merge of #68211 - GuillaumeGomez:add-failing-example-e0170, r=Dylan-DPC

Add failing example for E0170 explanation

r? @Dylan-DPC
This commit is contained in:
Yuki Okushi 2020-01-15 21:51:48 +09:00 committed by GitHub
commit 20c49fc797
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,24 @@
A pattern binding is using the same name as one of the variants of 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:
```