diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-06-17 11:30:24 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-06-17 11:35:00 -0700 |
| commit | e8228e1260d6568b143d9b2067293f53cb2d20c4 (patch) | |
| tree | 79af2e9e3206eb5241b5abc57495e77ea6983ad0 /src/comp | |
| parent | a4d88dacc9dd70547ece3dcc65fbc61a8fcfa91d (diff) | |
| download | rust-e8228e1260d6568b143d9b2067293f53cb2d20c4.tar.gz rust-e8228e1260d6568b143d9b2067293f53cb2d20c4.zip | |
rustc: Demand that if conditions have bool type
Closes #513
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/typeck.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index e238b554b53..fe4e049a07e 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -1712,6 +1712,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) { } case (ast::expr_if(?cond, ?thn, ?elsopt, ?a)) { check_expr(fcx, cond); + demand::simple(fcx, cond.span, + ty::mk_bool(fcx.ccx.tcx), + expr_ty(fcx.ccx.tcx, cond)); check_then_else(fcx, thn, elsopt, a, expr.span); } case (ast::expr_for(?decl, ?seq, ?body, ?a)) { |
