]> git.lizzy.rs Git - rust.git/blob - tests/ui/structs/suggest-replacing-field-when-specifying-same-type.rs
Rollup merge of #106793 - Mark-Simulacrum:normalize-test, r=compiler-errors
[rust.git] / tests / ui / structs / suggest-replacing-field-when-specifying-same-type.rs
1 enum Foo {
2     Bar { a: u8, b: i8, c: u8 },
3     Baz { a: f32 },
4     None,
5 }
6
7 fn main() {
8     let foo = Foo::None;
9     match foo {
10         Foo::Bar { a, aa: 1, c } => (),
11         //~^ ERROR variant `Foo::Bar` does not have a field named `aa` [E0026]
12         //~| ERROR pattern does not mention field `b` [E0027]
13         Foo::Baz { bb: 1.0 } => (),
14         //~^ ERROR variant `Foo::Baz` does not have a field named `bb` [E0026]
15         //~| ERROR pattern does not mention field `a` [E0027]
16         _ => (),
17     }
18
19     match foo {
20         Foo::Bar { a, aa: "", c } => (),
21         //~^ ERROR variant `Foo::Bar` does not have a field named `aa` [E0026]
22         //~| ERROR pattern does not mention field `b` [E0027]
23         Foo::Baz { bb: "" } => (),
24         //~^ ERROR variant `Foo::Baz` does not have a field named `bb` [E0026]
25         //~| pattern does not mention field `a` [E0027]
26         _ => (),
27     }
28 }