Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/rustc/middle/typeck/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,11 +973,25 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
_ {}
}
check_expr(fcx, rhs, none);

let mut extra = "";

// If the or operator is used it might be that the user forgot to
// supply the do keyword. Let's be more helpful in that situation.
if op == ast::or {
alt ty::get(lhs_resolved_t).struct {
ty::ty_fn(f) {
extra = ". Did you forget the 'do' keyword for the call?";
}
_ {}
}
}

tcx.sess.span_err(
ex.span, "binary operation " + ast_util::binop_to_str(op) +
" cannot be applied to type `" +
fcx.infcx.ty_to_str(lhs_resolved_t) +
"`");
"`" + extra);
(lhs_resolved_t, false)
}
fn check_user_unop(fcx: @fn_ctxt, op_str: str, mname: str,
Expand Down