rustc: Flatten recursive vectors in trans::simplify_type(). Prevents an infinite loop.

This commit is contained in:
Patrick Walton 2011-05-12 18:37:28 -07:00
parent b163247d4e
commit 5295a4dabd
2 changed files with 8 additions and 0 deletions

View File

@ -1231,6 +1231,9 @@ fn simplify_type(&@crate_ctxt ccx, &ty::t typ) -> ty::t {
case (ty::ty_box(_)) {
ret ty::mk_imm_box(ccx.tcx, ty::mk_nil(ccx.tcx));
}
case (ty::ty_vec(_)) {
ret ty::mk_imm_vec(ccx.tcx, ty::mk_nil(ccx.tcx));
}
case (_) { ret typ; }
}
}

View File

@ -427,6 +427,11 @@ fn mk_imm_box(&ctxt cx, &t ty) -> t {
}
fn mk_vec(&ctxt cx, &mt tm) -> t { ret gen_ty(cx, ty_vec(tm)); }
fn mk_imm_vec(&ctxt cx, &t typ) -> t {
ret gen_ty(cx, ty_vec(rec(ty=typ, mut=ast::imm)));
}
fn mk_port(&ctxt cx, &t ty) -> t { ret gen_ty(cx, ty_port(ty)); }
fn mk_chan(&ctxt cx, &t ty) -> t { ret gen_ty(cx, ty_chan(ty)); }
fn mk_task(&ctxt cx) -> t { ret gen_ty(cx, ty_task); }