rustc: Use demand functions instead of open-coded typecheck for spawn

Un-xfail spawn-non-nil-fn
This commit is contained in:
Brian Anderson 2011-05-24 20:19:36 -04:00
parent 0c1ea141b4
commit 6473b73174
2 changed files with 1 additions and 18 deletions

View file

@ -2386,23 +2386,8 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
case (ast::expr_spawn(_, _, ?f, ?args, ?a)) {
check_call(scx, f, args);
// Check the return type
auto fty = expr_ty(scx.fcx.ccx.tcx, f);
alt (struct(scx.fcx.ccx.tcx, fty)) {
case (ty::ty_fn(_,_,?rt,_)) {
alt (struct(scx.fcx.ccx.tcx, rt)) {
case (ty::ty_nil) {
// This is acceptable
}
case (_) {
auto err = "non-nil return type in "
+ "spawned function";
scx.fcx.ccx.tcx.sess.span_err(expr.span, err);
fail;
}
}
}
}
Demand::simple(scx, f.span, ty::mk_nil(scx.fcx.ccx.tcx), fty);
// FIXME: Other typechecks needed