Skip to content

Commit

Permalink
Don't visit items in removed branches
Browse files Browse the repository at this point in the history
Note that they will be visited anyway by base::trans_item, this just duplicates the items.
  • Loading branch information
nrc committed Jun 4, 2015
1 parent ce750d1 commit df96fb0
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/librustc_trans/trans/controlflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ use syntax::ast;
use syntax::ast_util;
use syntax::parse::token::InternedString;
use syntax::parse::token;
use syntax::visit::Visitor;

pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
s: &ast::Stmt)
Expand Down Expand Up @@ -171,16 +170,7 @@ pub fn trans_if<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
// if true { .. } [else { .. }]
bcx = trans_block(bcx, &*thn, dest);
trans::debuginfo::clear_source_location(bcx.fcx);

if let Some(elexpr) = els {
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx };
trans.visit_expr(&*elexpr);
}
} else {
// if false { .. } [else { .. }]
let mut trans = TransItemVisitor { ccx: bcx.fcx.ccx };
trans.visit_block(&*thn);

if let Some(elexpr) = els {
bcx = expr::trans_into(bcx, &*elexpr, dest);
trans::debuginfo::clear_source_location(bcx.fcx);
Expand Down

0 comments on commit df96fb0

Please sign in to comment.