This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 11fn foo ( ) {
2+ //~^ HELP try adding a return type
23 |x : & i32 | 1i32
34 //~^ ERROR mismatched types
45}
56
7+ fn bar ( i : impl Sized ) {
8+ //~^ HELP a return type might be missing here
9+ || i
10+ //~^ ERROR mismatched types
11+ }
12+
613fn main ( ) { }
Original file line number Diff line number Diff line change 11error[E0308]: mismatched types
2- --> $DIR/return-closures.rs:2 :5
2+ --> $DIR/return-closures.rs:3 :5
33 |
44LL | fn foo() {
55 | - help: try adding a return type: `-> impl for<'r> Fn(&'r i32) -> i32`
6+ LL |
67LL | |x: &i32| 1i32
78 | ^^^^^^^^^^^^^^ expected `()`, found closure
89 |
910 = 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]`
1112
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
1326
1427For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments