]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0423.rs
Suggest `if let`/`let_else` for refutable pat in `let`
[rust.git] / src / test / ui / error-codes / E0423.rs
1 fn main () {
2     struct Foo { a: bool };
3
4     let f = Foo(); //~ ERROR E0423
5 }
6
7 fn bar() {
8     struct S { x: i32, y: i32 }
9     #[derive(PartialEq)]
10     struct T {}
11
12     if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
13     //~^ ERROR struct literals are not allowed here
14     if T {} == T {} { println!("Ok"); }
15     //~^ ERROR E0423
16     //~| ERROR expected expression, found `==`
17 }
18
19 fn foo() {
20     for _ in std::ops::Range { start: 0, end: 10 } {}
21     //~^ ERROR struct literals are not allowed here
22 }