From 523a0884511e11fa686badfca7c1aa7445761d7e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 22 Jun 2011 20:50:53 -0700 Subject: [PATCH] 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. --- src/comp/middle/typeck.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 1ad5bb693a7..6b9d6cf2118 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1467,7 +1467,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) { auto lhs_t = expr_ty(fcx.ccx.tcx, lhs); auto rhs_t = expr_ty(fcx.ccx.tcx, rhs); - demand::autoderef(fcx, expr.span, lhs_t, rhs_t, AUTODEREF_OK); + demand::autoderef(fcx, rhs.span, lhs_t, rhs_t, AUTODEREF_OK); // FIXME: Binops have a bit more subtlety than this.