@@ -4677,10 +4677,6 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
4677
4677
let ty = node_id_type ( bcx_ccx ( bcx) , local. node . id ) ;
4678
4678
let llptr = bcx. fcx . lllocals . get ( local. node . id ) ;
4679
4679
4680
- if must_zero ( bcx_ccx ( bcx) , local) {
4681
- bcx = zero_alloca ( bcx, llptr, ty) ;
4682
- }
4683
-
4684
4680
alt local. node . init {
4685
4681
some ( init) {
4686
4682
alt init. op {
@@ -4694,48 +4690,12 @@ fn init_local(bcx: @block_ctxt, local: @ast::local) -> @block_ctxt {
4694
4690
}
4695
4691
}
4696
4692
}
4697
- _ { }
4693
+ _ { bcx = zero_alloca ( bcx , llptr , ty ) ; }
4698
4694
}
4699
4695
// Make a note to drop this slot on the way out.
4700
4696
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 ) ;
4739
4699
}
4740
4700
4741
4701
fn init_ref_local ( bcx : @block_ctxt , local : @ast:: local ) -> @block_ctxt {
0 commit comments