]> git.lizzy.rs Git - rust.git/blob - src/test/ui/parser/expr-as-stmt-2.stderr
Merge commit '7b73b60faca71d01d900e49831fcb84553e93019' into sync-rustfmt
[rust.git] / src / test / ui / parser / expr-as-stmt-2.stderr
1 error[E0308]: mismatched types
2   --> $DIR/expr-as-stmt-2.rs:3:26
3    |
4 LL |     if let Some(x) = a { true } else { false }
5    |     ---------------------^^^^-----------------
6    |     |                    |
7    |     |                    expected `()`, found `bool`
8    |     expected this to be `()`
9    |
10 help: you might have meant to return this value
11    |
12 LL |     if let Some(x) = a { return true; } else { false }
13    |                          ++++++     +
14
15 error[E0308]: mismatched types
16   --> $DIR/expr-as-stmt-2.rs:3:40
17    |
18 LL |     if let Some(x) = a { true } else { false }
19    |     -----------------------------------^^^^^--
20    |     |                                  |
21    |     |                                  expected `()`, found `bool`
22    |     expected this to be `()`
23    |
24 help: you might have meant to return this value
25    |
26 LL |     if let Some(x) = a { true } else { return false; }
27    |                                        ++++++      +
28
29 error[E0308]: mismatched types
30   --> $DIR/expr-as-stmt-2.rs:6:5
31    |
32 LL |   fn foo(a: Option<u32>, b: Option<u32>) -> bool {
33    |                                             ---- expected `bool` because of return type
34 ...
35 LL | /     &&
36 LL | |     if let Some(y) = a { true } else { false }
37    | |______________________________________________^ expected `bool`, found `&&bool`
38    |
39 help: consider removing the `&&`
40    |
41 LL -     &&
42 LL +     if let Some(y) = a { true } else { false }
43    | 
44 help: parentheses are required to parse this as an expression
45    |
46 LL |     (if let Some(x) = a { true } else { false })
47    |     +                                          +
48
49 error: aborting due to 3 previous errors
50
51 For more information about this error, try `rustc --explain E0308`.