Fix unsafe uses of aliases in tail calls

This commit is contained in:
Marijn Haverbeke 2011-06-15 21:38:43 +02:00
parent 0987b17dcb
commit b2b8002fd3
3 changed files with 48 additions and 31 deletions

View file

@ -1115,7 +1115,7 @@ fn trans_non_gc_free(&@block_ctxt cx, ValueRef v) -> result {
fn find_scope_cx(&@block_ctxt cx) -> @block_ctxt {
if (cx.kind != NON_SCOPE_BLOCK) { ret cx; }
alt (cx.parent) {
case (parent_some(?b)) { be find_scope_cx(b); }
case (parent_some(?b)) { ret find_scope_cx(b); }
case (parent_none) {
cx.fcx.lcx.ccx.sess.bug("trans::find_scope_cx() " +
"called on parentless block_ctxt");
@ -2455,7 +2455,7 @@ fn iter_structural_ty(&@block_ctxt cx, ValueRef v, &ty::t t, val_and_ty_fn f)
ty::t t) -> result {
ret f(cx, av, t);
}
be iter_structural_ty_full(cx, v, v, t, bind adaptor_fn(f, _, _, _, _));
ret iter_structural_ty_full(cx, v, v, t, bind adaptor_fn(f, _, _, _, _));
}
fn iter_structural_ty_full(&@block_ctxt cx, ValueRef av, ValueRef bv,
@ -2693,8 +2693,8 @@ fn iter_sequence_inner(&@block_ctxt cx, ValueRef src,
ret f(cx, load_if_immediate(cx, p, elt_ty), elt_ty);
}
auto elt_sz = size_of(cx, elt_ty);
be iter_sequence_raw(elt_sz.bcx, src, src, src_lim, elt_sz.val,
bind adaptor_fn(f, elt_ty, _, _, _));
ret iter_sequence_raw(elt_sz.bcx, src, src, src_lim, elt_sz.val,
bind adaptor_fn(f, elt_ty, _, _, _));
}

View file

@ -388,7 +388,7 @@ mod write {
// Writes a type parameter count and type pair into the node type table.
fn ty(&ty::ctxt tcx, uint node_id, &ty_param_substs_opt_and_ty tpot) {
assert (!ty::type_contains_vars(tcx, tpot._1));
be inner(tcx.node_types, node_id, tpot);
ret inner(tcx.node_types, node_id, tpot);
}
// Writes a type parameter count and type pair into the node type table.
@ -404,23 +404,23 @@ mod write {
// Writes a type with no type parameters into the node type table.
fn ty_only(&ty::ctxt tcx, uint node_id, ty::t typ) {
be ty(tcx, node_id, tup(none[vec[ty::t]], typ));
ret ty(tcx, node_id, tup(none[vec[ty::t]], typ));
}
// Writes a type with no type parameters into the node type table. This
// function allows for the possibility of type variables.
fn ty_only_fixup(@fn_ctxt fcx, uint node_id, ty::t typ) {
be ty_fixup(fcx, node_id, tup(none[vec[ty::t]], typ));
ret ty_fixup(fcx, node_id, tup(none[vec[ty::t]], typ));
}
// Writes a nil type into the node type table.
fn nil_ty(&ty::ctxt tcx, uint node_id) {
be ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_nil(tcx)));
ret ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_nil(tcx)));
}
// Writes the bottom type into the node type table.
fn bot_ty(&ty::ctxt tcx, uint node_id) {
be ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_bot(tcx)));
ret ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_bot(tcx)));
}
}