Skip to content

Commit cc06bd4

Browse files
committed
rustc: Add some miscellaneous demands that pushdown had previously caught; put out burning tinderbox
1 parent b02b50c commit cc06bd4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/comp/middle/typeck.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
16281628
assert (ast::is_call_expr(e));
16291629

16301630
check_expr(fcx, e);
1631+
demand::simple(fcx, e.span, fcx.ret_ty, expr_ty(fcx.ccx.tcx, e));
1632+
16311633
write::nil_ty(fcx.ccx.tcx, a.id);
16321634
}
16331635

@@ -1713,7 +1715,11 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17131715
auto lhs_t = expr_ty(fcx.ccx.tcx, lhs);
17141716
alt (struct(fcx.ccx.tcx, lhs_t)) {
17151717
case (ty::ty_chan(?it)) { item_t = it; }
1716-
case (_) { fail; }
1718+
case (_) {
1719+
fcx.ccx.tcx.sess.span_err(expr.span,
1720+
#fmt("mismatched types: expected chan but found %s",
1721+
ty_to_str(fcx.ccx.tcx, lhs_t)));
1722+
}
17171723
}
17181724

17191725
write::ty_only_fixup(fcx, a.id, chan_t);
@@ -1742,6 +1748,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17421748

17431749
auto thn_t = block_ty(fcx.ccx.tcx, thn);
17441750
auto elsopt_t = expr_ty(fcx.ccx.tcx, els);
1751+
1752+
demand::simple(fcx, expr.span, thn_t, elsopt_t);
1753+
17451754
if (!ty::type_is_bot(fcx.ccx.tcx, elsopt_t)) {
17461755
elsopt_t
17471756
} else {
@@ -1790,6 +1799,9 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
17901799
check_expr(fcx, cond);
17911800
check_block(fcx, body);
17921801

1802+
demand::simple(fcx, cond.span, ty::mk_bool(fcx.ccx.tcx),
1803+
expr_ty(fcx.ccx.tcx, cond));
1804+
17931805
auto typ = ty::mk_nil(fcx.ccx.tcx);
17941806
write::ty_only_fixup(fcx, a.id, typ);
17951807
}

0 commit comments

Comments
 (0)