]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/issue-67776-match-same-name-enum-variant-refs.rs
check_match: unify some lowering code and fix some ICEs
[rust.git] / src / test / ui / pattern / issue-67776-match-same-name-enum-variant-refs.rs
1 // Test for issue #67776: binding named the same as enum variant
2 // should report a warning even when matching against a reference type
3
4 // check-pass
5
6 #![allow(unused_variables)]
7 #![allow(non_snake_case)]
8
9 enum Foo {
10     Bar,
11     Baz,
12 }
13
14
15 fn fn1(e: Foo) {
16     match e {
17         Bar => {},
18         //~^ WARNING named the same as one of the variants of the type `Foo`
19         Baz => {},
20         //~^ WARNING named the same as one of the variants of the type `Foo`
21     }
22 }
23
24 fn fn2(e: &Foo) {
25     match e {
26         Bar => {},
27         //~^ WARNING named the same as one of the variants of the type `Foo`
28         Baz => {},
29         //~^ WARNING named the same as one of the variants of the type `Foo`
30     }
31 }
32
33 fn fn3(e: &mut &&mut Foo) {
34     match e {
35         Bar => {},
36         //~^ WARNING named the same as one of the variants of the type `Foo`
37         Baz => {},
38         //~^ WARNING named the same as one of the variants of the type `Foo`
39     }
40 }
41
42 fn main() {}