提交 a3a27374 编写于 作者: M Marijn Haverbeke

Don't descend into functions from relax_precond_block

Closes #913
上级 759fc101
...@@ -4091,7 +4091,7 @@ fn trans_rec(bcx: @block_ctxt, fields: [ast::field], ...@@ -4091,7 +4091,7 @@ fn trans_rec(bcx: @block_ctxt, fields: [ast::field],
for tf in ty_fields { for tf in ty_fields {
let dst = GEP_tup_like_1(bcx, t, addr, [0, i]); let dst = GEP_tup_like_1(bcx, t, addr, [0, i]);
bcx = dst.bcx; bcx = dst.bcx;
// FIXME make this {|f| str::eq(f.node.ident, tf.ident)} again when // FIXME make this again when
// bug #913 is fixed // bug #913 is fixed
fn test(n: str, f: ast::field) -> bool { str::eq(f.node.ident, n) } fn test(n: str, f: ast::field) -> bool { str::eq(f.node.ident, n) }
alt vec::find(bind test(tf.ident, _), fields) { alt vec::find(bind test(tf.ident, _), fields) {
......
...@@ -150,7 +150,8 @@ fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) { ...@@ -150,7 +150,8 @@ fn relax_precond_block(fcx: fn_ctxt, i: node_id, b: blk) {
visit_expr: relax_precond_expr, visit_expr: relax_precond_expr,
visit_stmt: relax_precond_stmt, visit_stmt: relax_precond_stmt,
visit_item: visit_item:
fn (_i: @item, _cx: relax_ctxt, _vt: visit::vt<relax_ctxt>) { } fn (_i: @item, _cx: relax_ctxt, _vt: visit::vt<relax_ctxt>) { },
visit_fn: do_nothing
with *visitor}; with *visitor};
let v1 = visit::mk_vt(visitor); let v1 = visit::mk_vt(visitor);
v1.visit_block(b, cx, v1); v1.visit_block(b, cx, v1);
......
...@@ -130,19 +130,14 @@ fn mk_fn_info(ccx: crate_ctxt, f: _fn, tp: [ty_param], f_sp: span, ...@@ -130,19 +130,14 @@ fn mk_fn_info(ccx: crate_ctxt, f: _fn, tp: [ty_param], f_sp: span,
// "diverges" constraint // "diverges" constraint
let diverges_id = ccx.tcx.sess.next_node_id(); let diverges_id = ccx.tcx.sess.next_node_id();
let diverges_name = name + "!"; let diverges_name = name + "!";
add_constraint(cx.tcx, respan(f_sp, ninit(diverges_id, diverges_name)), next = add_constraint(cx.tcx, respan(f_sp, ninit(diverges_id,
next, res_map); diverges_name)),
next, res_map);
let v: @mutable [node_id] = @mutable []; let v: @mutable [node_id] = @mutable [];
let rslt = let rslt =
{constrs: res_map, {constrs: res_map,
num_constraints: next,
// add 2 to account for the i_return and i_diverge constraints
// FIXME the 1u here is a kludge to make bug #913's impact somewhat
// smaller. it should be removed once the bug is really fixed
num_constraints:
vec::len(*cx.cs) + vec::len(f.decl.constraints) +
vec::len(f.decl.inputs) + 2u + 1u,
cf: f.decl.cf, cf: f.decl.cf,
i_return: ninit(id, name), i_return: ninit(id, name),
i_diverge: ninit(diverges_id, diverges_name), i_diverge: ninit(diverges_id, diverges_name),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册