fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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