Closed
Description
fn foo() -> i32 {
42
}
fn main() {
foo > 12;
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
--> src/main.rs:6:5
|
6 | foo > 12;
| ^^^^^^^^
|
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
error[E0308]: mismatched types
--> src/main.rs:6:11
|
6 | foo > 12;
| ^^ expected fn item, found integer
|
= note: expected type `fn() -> i32 {foo}`
found type `{integer}`
error: aborting due to 2 previous errors
A much more useful note would be to suggest to the user that a instead of comparing function she should compare result of function evaluation - rustc should suggest that user should add pair of parentheses to call a function ("did you forget the ‘()’ ?").