File tree 2 files changed +23
-3
lines changed
2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1
1
fn foo ( ) {
2
+ //~^ HELP try adding a return type
2
3
|x : & i32 | 1i32
3
4
//~^ ERROR mismatched types
4
5
}
5
6
7
+ fn bar ( i : impl Sized ) {
8
+ //~^ HELP a return type might be missing here
9
+ || i
10
+ //~^ ERROR mismatched types
11
+ }
12
+
6
13
fn main ( ) { }
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/return-closures.rs:2 :5
2
+ --> $DIR/return-closures.rs:3 :5
3
3
|
4
4
LL | fn foo() {
5
5
| - help: try adding a return type: `-> impl for<'r> Fn(&'r i32) -> i32`
6
+ LL |
6
7
LL | |x: &i32| 1i32
7
8
| ^^^^^^^^^^^^^^ expected `()`, found closure
8
9
|
9
10
= note: expected unit type `()`
10
- found closure `[closure@$DIR/return-closures.rs:2 :5: 2 :14]`
11
+ found closure `[closure@$DIR/return-closures.rs:3 :5: 3 :14]`
11
12
12
- error: aborting due to previous error
13
+ error[E0308]: mismatched types
14
+ --> $DIR/return-closures.rs:9:5
15
+ |
16
+ LL | fn bar(i: impl Sized) {
17
+ | - help: a return type might be missing here: `-> _`
18
+ LL |
19
+ LL | || i
20
+ | ^^^^ expected `()`, found closure
21
+ |
22
+ = note: expected unit type `()`
23
+ found closure `[closure@$DIR/return-closures.rs:9:5: 9:7]`
24
+
25
+ error: aborting due to 2 previous errors
13
26
14
27
For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments