]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-51102.rs
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-51102.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 enum SimpleEnum {
12     NoState,
13 }
14
15 struct SimpleStruct {
16     no_state_here: u64,
17 }
18
19 fn main() {
20     let _ = |simple| {
21         match simple {
22             SimpleStruct {
23                 state: 0,
24                 //~^ struct `SimpleStruct` does not have a field named `state` [E0026]
25                 ..
26             } => (),
27         }
28     };
29
30     let _ = |simple| {
31         match simple {
32             SimpleStruct {
33                 no_state_here: 0,
34                 no_state_here: 1
35                 //~^ ERROR field `no_state_here` bound multiple times in the pattern [E0025]
36             } => (),
37         }
38     };
39
40     let _ = |simple| {
41         match simple {
42             SimpleEnum::NoState {
43                 state: 0
44                 //~^ ERROR variant `SimpleEnum::NoState` does not have a field named `state` [E0026]
45             } => (),
46         }
47     };
48 }