]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/bad-if-statements.rs
Auto merge of #100678 - GuillaumeGomez:improve-rustdoc-json-tests, r=aDotInTheVoid
[rust.git] / src / test / ui / parser / bad-if-statements.rs
1 fn a() {
2     if {}
3     //~^ ERROR missing condition for `if` expression
4 }
5
6 fn b() {
7     if true && {}
8     //~^ ERROR this `if` expression is missing a block after the condition
9 }
10
11 fn c() {
12     let x = {};
13     if true x
14     //~^ ERROR expected `{`, found `x`
15 }
16
17 fn a2() {
18     if {} else {}
19     //~^ ERROR missing condition for `if` expression
20 }
21
22 fn b2() {
23     if true && {} else {}
24     //~^ ERROR this `if` expression is missing a block after the condition
25 }
26
27 fn c2() {
28     let x = {};
29     if true x else {}
30     //~^ ERROR expected `{`, found `x`
31 }
32
33 fn d() {
34     if true else {}
35     //~^ ERROR this `if` expression is missing a block after the condition
36 }
37
38 fn main() {}