]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0027.rs
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / error-codes / E0027.rs
1 struct Dog {
2     name: String,
3     age: u32,
4 }
5
6
7 fn main() {
8     let d = Dog { name: "Rusty".to_string(), age: 8 };
9
10     match d {
11         Dog { age: x } => {} //~ ERROR pattern does not mention field `name`
12     }
13     match d {
14         // trailing comma
15         Dog { name: x, } => {} //~ ERROR pattern does not mention field `age`
16     }
17     match d {
18         // trailing comma with weird whitespace
19         Dog { name: x  , } => {} //~ ERROR pattern does not mention field `age`
20     }
21     match d {
22         Dog {} => {} //~ ERROR pattern does not mention fields `name`, `age`
23     }
24 }