From 348cd86d87521ba6ee74c3f06d13fcccf6b8a7f3 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Fri, 23 Sep 2011 11:19:15 +0200 Subject: [PATCH] Properly check types of do-while condition expr Closes #956 --- src/comp/middle/typeck.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 7d7936b6cf1..c5a883b2bb6 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1920,7 +1920,8 @@ fn check_binop_type_compat(fcx: @fn_ctxt, span: span, ty: ty::t, write::ty_only_fixup(fcx, id, ty::mk_nil(tcx)); } ast::expr_do_while(body, cond) { - bot = check_expr(fcx, cond) | check_block(fcx, body); + bot = check_expr_with(fcx, cond, ty::mk_bool(tcx)) | + check_block(fcx, body); write::ty_only_fixup(fcx, id, block_ty(tcx, body)); } ast::expr_alt(expr, arms) {