about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorJakub Bukaj <jakub@jakub.cc>2014-11-20 16:57:36 +0100
committerJakub Bukaj <jakub@jakub.cc>2014-11-26 22:21:52 +0000
commit5804a306868aee5ff0a3d7829db7924978317f0e (patch)
treef269799695b88cd0d00df02549ad77bfa7faf5b1 /src/rustllvm/RustWrapper.cpp
parent6faff24ec85744de092a7d7c2378370f65d623bb (diff)
downloadrust-5804a306868aee5ff0a3d7829db7924978317f0e.tar.gz
rust-5804a306868aee5ff0a3d7829db7924978317f0e.zip
Warn on pattern bindings that have the same name as a variant
...of the type being matched.

This change will result in a better diagnostic for code like the following:

```rust
enum Enum {
    Foo,
    Bar
}

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

which would currently simply fail with an unreachable pattern error
on the 2nd arm.

The user is advised to either use a qualified path in the patterns
or import the variants explicitly into the scope.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions