rust-lang/rust — pull request #19115 by jakub- (2014-11-19 19:51:14+00:00)
Title: Forbid pattern bindings that have the same name as a variant

...of the type being matched.

This change will in most cases offer a better error message
for code like the following:

```rust
enum Enum {
Foo,
Bar
}

fn f(x: Enum) {
match x {
Foo => (),
Bar => ()
}
}
```

which would currently fail with an `unreachable pattern` error.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.

In subtle cases, this change will also break code that is currently
accepted albeit in all likelihood unintended, most notably code
matching on enums with a single variant. Therefore, it is a

[breaking-change]

Closes https://github.com/rust-lang/rust/issues/4639.