1 error[E0308]: mismatched types
2 --> $DIR/return-bindings.rs:3:17
4 LL | fn a(i: i32) -> i32 {}
5 | - ^^^ expected `i32`, found `()`
7 | implicitly returns `()` as its body has no tail or `return` expression
9 help: consider returning the local binding `i`
11 LL | fn a(i: i32) -> i32 { i }
14 error[E0308]: mismatched types
15 --> $DIR/return-bindings.rs:7:46
17 LL | let s: String = if let Some(s) = opt_str {
18 | ______________________________________________^
21 | |_____^ expected struct `String`, found `()`
23 help: consider returning the local binding `s`
25 LL ~ let s: String = if let Some(s) = opt_str {
30 error[E0308]: mismatched types
31 --> $DIR/return-bindings.rs:14:11
33 LL | fn c() -> Option<i32> {
34 | - ^^^^^^^^^^^ expected enum `Option`, found `()`
36 | implicitly returns `()` as its body has no tail or `return` expression
38 = note: expected enum `Option<i32>`
40 help: consider returning the local binding `x`
46 error[E0308]: mismatched types
47 --> $DIR/return-bindings.rs:20:46
49 LL | let s: String = if let Some(s) = opt_str {
50 | ______________________________________________^
53 | |_____^ expected struct `String`, found `()`
55 help: consider returning the local binding `s`
57 LL ~ let s: String = if let Some(s) = opt_str {
62 error[E0308]: `if` and `else` have incompatible types
63 --> $DIR/return-bindings.rs:30:9
65 LL | let s = if let Some(s) = opt_str {
66 | ______________________________________-
68 | |_____- expected because of this
70 | ^^^^^^^^^^^^^ expected `()`, found struct `String`
72 help: consider returning the local binding `s`
74 LL ~ let s = if let Some(s) = opt_str {
79 error[E0308]: mismatched types
80 --> $DIR/return-bindings.rs:37:20
83 | ^^ expected struct `String`, found `()`
85 help: consider returning the local binding `s`
90 error[E0308]: `match` arms have incompatible types
91 --> $DIR/return-bindings.rs:46:17
93 LL | let s = match opt_str {
96 | | -- this is found to be of type `()`
97 LL | | None => String::new(),
98 | | ^^^^^^^^^^^^^ expected `()`, found struct `String`
101 | |_____- `match` arms have incompatible types
103 help: consider returning the local binding `s`
105 LL | Some(s) => { s }
108 error: aborting due to 7 previous errors
110 For more information about this error, try `rustc --explain E0308`.