]> git.lizzy.rs Git - rust.git/blob - tests/ui/pattern/issue-67776-match-same-name-enum-variant-refs.rs
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
[rust.git] / tests / 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 an error even when matching against a reference type
3
4 #![allow(unused_variables)]
5 #![allow(non_snake_case)]
6
7 enum Foo {
8     Bar,
9     Baz,
10 }
11
12
13 fn fn1(e: Foo) {
14     match e {
15         Bar => {},
16         //~^ ERROR named the same as one of the variants of the type `Foo`
17         Baz => {},
18         //~^ ERROR named the same as one of the variants of the type `Foo`
19     }
20 }
21
22 fn fn2(e: &Foo) {
23     match e {
24         Bar => {},
25         //~^ ERROR named the same as one of the variants of the type `Foo`
26         Baz => {},
27         //~^ ERROR named the same as one of the variants of the type `Foo`
28     }
29 }
30
31 fn fn3(e: &mut &&mut Foo) {
32     match e {
33         Bar => {},
34         //~^ ERROR named the same as one of the variants of the type `Foo`
35         Baz => {},
36         //~^ ERROR named the same as one of the variants of the type `Foo`
37     }
38 }
39
40 fn main() {}