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 unit type `()` found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14]` error[E0618]: expected function, found `()` --> $DIR/issue-20862.rs:7:13 | LL | fn foo(x: i32) { | -------------- `foo` defined here returns `()` ... LL | let x = foo(5)(2); | ^^^^^^--- | | | call expression requires function error: aborting due to 2 previous errors Some errors have detailed explanations: E0308, E0618. For more information about an error, try `rustc --explain E0308`.