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:
commit
20c49fc797
1 changed files with 21 additions and 0 deletions
|
|
@ -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:
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue