File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -973,11 +973,25 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
973
973
_ { }
974
974
}
975
975
check_expr ( fcx, rhs, none) ;
976
+
976
977
tcx. sess . span_err (
977
978
ex. span , "binary operation " + ast_util:: binop_to_str ( op) +
978
979
" cannot be applied to type `" +
979
980
fcx. infcx . ty_to_str ( lhs_resolved_t) +
980
981
"`" ) ;
982
+
983
+ // If the or operator is used it might be that the user forgot to
984
+ // supply the do keyword. Let's be more helpful in that situation.
985
+ if op == ast:: or {
986
+ alt ty:: get ( lhs_resolved_t) . struct {
987
+ ty:: ty_fn ( f) {
988
+ tcx. sess . span_note (
989
+ ex. span , "did you forget the 'do' keyword for the call?" ) ;
990
+ }
991
+ _ { }
992
+ }
993
+ }
994
+
981
995
( lhs_resolved_t, false )
982
996
}
983
997
fn check_user_unop ( fcx : @fn_ctxt , op_str : str , mname : str ,
You can’t perform that action at this time.
0 commit comments