error[E0308]: mismatched types --> $DIR/issue-20862.rs:2:5 | LL | fn foo(x: i32) { | - possibly return type missing here? LL | |y| x + y | ^^^^^^^^^ expected (), found closure | = note: expected type `()` found type `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` error[E0618]: expected function, found `()` --> $DIR/issue-20862.rs:7:13 | LL | / fn foo(x: i32) { LL | | |y| x + y LL | | //~^ ERROR: mismatched types LL | | } | |_- `foo` defined here returns `()` ... LL | let x = foo(5)(2); | ^^^^^^--- | | | call expression requires function error: aborting due to 2 previous errors Some errors occurred: E0308, E0618. For more information about an error, try `rustc --explain E0308`.