use super::{FnCtxt, Needs};
use super::method::MethodCallee;
use rustc::ty::{self, Ty, TypeFoldable};
-use rustc::ty::TyKind::{Ref, Adt, Str, Uint, Never, Tuple, Char, Array};
+use rustc::ty::TyKind::{Ref, Adt, FnDef, Str, Uint, Never, Tuple, Char, Array};
use rustc::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
use rustc::infer::type_variable::TypeVariableOrigin;
use errors::{self,Applicability};
if !lhs_expr.span.eq(&rhs_expr.span) {
err.span_label(lhs_expr.span, lhs_ty.to_string());
+ if let FnDef(..) = lhs_ty.sty {
+ err.span_label(lhs_expr.span, "did you forget `()`?");
+ }
+
err.span_label(rhs_expr.span, rhs_ty.to_string());
+ if let FnDef(..) = rhs_ty.sty {
+ err.span_label(rhs_expr.span, "did you forget `()`?");
+ }
}
+
let mut suggested_deref = false;
if let Ref(_, mut rty, _) = lhs_ty.sty {
if {
--- /dev/null
+error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
+ --> $DIR/issue-59488.rs:6:9
+ |
+LL | foo > 12;
+ | --- ^ -- {integer}
+ | |
+ | fn() -> i32 {foo}
+ | did you forget `()`?
+ |
+ = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-59488.rs:6:11
+ |
+LL | foo > 12;
+ | ^^ expected fn item, found integer
+ |
+ = note: expected type `fn() -> i32 {foo}`
+ found type `{integer}`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0308, E0369.
+For more information about an error, try `rustc --explain E0308`.