Skip to content

Commit 3f00391

Browse files
committed
---
yaml --- r: 5589 b: refs/heads/master c: 759fc10 h: refs/heads/master i: 5587: c157dd0 v: v3
1 parent bebaab7 commit 3f00391

File tree

2 files changed

+4
-44
lines changed

2 files changed

+4
-44
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 16d5aaa96217555f4cba76e03b60ca7d1aaad935
2+
refs/heads/master: 759fc101fbd6db4c8384ca5858ed82a729ac520f

trunk/src/comp/middle/trans.rs

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4677,10 +4677,6 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
46774677
let ty = node_id_type(bcx_ccx(bcx), local.node.id);
46784678
let llptr = bcx.fcx.lllocals.get(local.node.id);
46794679

4680-
if must_zero(bcx_ccx(bcx), local) {
4681-
bcx = zero_alloca(bcx, llptr, ty);
4682-
}
4683-
46844680
alt local.node.init {
46854681
some(init) {
46864682
alt init.op {
@@ -4694,48 +4690,12 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
46944690
}
46954691
}
46964692
}
4697-
_ { }
4693+
_ { bcx = zero_alloca(bcx, llptr, ty); }
46984694
}
46994695
// Make a note to drop this slot on the way out.
47004696
add_clean(bcx, llptr, ty);
4701-
bcx = trans_alt::bind_irrefutable_pat(bcx, local.node.pat, llptr,
4702-
bcx.fcx.lllocals, false);
4703-
ret bcx;
4704-
4705-
fn must_zero(ccx: @crate_ctxt, local: @ast::local) -> bool {
4706-
alt local.node.init {
4707-
some(init) { might_not_init(ccx, init.expr) }
4708-
none. { true }
4709-
}
4710-
}
4711-
4712-
fn might_not_init(ccx: @crate_ctxt, expr: @ast::expr) -> bool {
4713-
type env = {mutable mightnt: bool,
4714-
ccx: @crate_ctxt};
4715-
let e = {mutable mightnt: false,
4716-
ccx: ccx};
4717-
fn visit_expr(ex: @ast::expr, e: env, v: vt<env>) {
4718-
let might_not_init = alt ex.node {
4719-
ast::expr_alt(_, _) { true }
4720-
ast::expr_ret(_) { true }
4721-
ast::expr_break. { true }
4722-
ast::expr_cont. { true }
4723-
ast::expr_call(_, _) { true }
4724-
_ {
4725-
let ex_ty = ty::expr_ty(e.ccx.tcx, ex);
4726-
ty::type_is_bot(e.ccx.tcx, ex_ty)
4727-
}
4728-
};
4729-
if might_not_init {
4730-
e.mightnt = true;
4731-
} else { visit::visit_expr(ex, e, v); }
4732-
}
4733-
let visitor =
4734-
visit::mk_vt(@{visit_expr: visit_expr
4735-
with *visit::default_visitor()});
4736-
visitor.visit_expr(expr, e, visitor);
4737-
ret e.mightnt;
4738-
}
4697+
ret trans_alt::bind_irrefutable_pat(bcx, local.node.pat, llptr,
4698+
bcx.fcx.lllocals, false);
47394699
}
47404700

47414701
fn init_ref_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {

0 commit comments

Comments
 (0)