Skip to content

Commit 523a088

Browse files
committed
rustc: Use the rhs span when unifying binops
This makes the error message correctly identify the term that wasn't the expected type. Issue #516.
1 parent ae234d6 commit 523a088

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/comp/middle/typeck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
14671467
auto lhs_t = expr_ty(fcx.ccx.tcx, lhs);
14681468
auto rhs_t = expr_ty(fcx.ccx.tcx, rhs);
14691469

1470-
demand::autoderef(fcx, expr.span, lhs_t, rhs_t, AUTODEREF_OK);
1470+
demand::autoderef(fcx, rhs.span, lhs_t, rhs_t, AUTODEREF_OK);
14711471

14721472
// FIXME: Binops have a bit more subtlety than this.
14731473

0 commit comments

Comments
 (0)