From 7e7e326ee672e7540ae7274dc5cc96d6af909b6c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 3 Jul 2011 23:38:58 -0400 Subject: [PATCH] Make use of demand::simple instead of manually checking fail expr type. --- src/comp/middle/typeck.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 6fbe6493061e..41a2daf0e448 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -229,11 +229,6 @@ fn type_is_scalar(&@fn_ctxt fcx, &span sp, ty::t typ) -> bool { ret ty::type_is_scalar(fcx.ccx.tcx, typ_s); } -fn type_is_str(&@fn_ctxt fcx, &span sp, ty::t typ) -> bool { - auto typ_s = structurally_resolved_type(fcx, sp, typ); - ret ty::type_is_str(fcx.ccx.tcx, typ_s); -} - // Parses the programmer's textual representation of a type into our internal // notion of a type. `getter` is a function that returns the type @@ -1667,12 +1662,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) { check_expr(fcx, e); auto tcx = fcx.ccx.tcx; auto ety = expr_ty(tcx, e); - if (!type_is_str(fcx, e.span, ety)) { - tcx.sess.span_fatal(e.span, - #fmt("mismatched types: expected \ - str, found %s", - ty_to_str(tcx, ety))); - } + demand::simple(fcx, e.span, ty::mk_str(tcx), ety); } } write::bot_ty(fcx.ccx.tcx, id);