Skip to content

Commit

Permalink
Fix rust-lang#43457 (and avoid some unneeded lookups to boot, woo).
Browse files Browse the repository at this point in the history
  • Loading branch information
pnkfelix committed Aug 25, 2017
1 parent 6722996 commit b8d8dc3
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/librustc_mir/hair/cx/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
// We have to eagerly translate the "spine" of the statements
// in order to get the lexical scoping correctly.
let stmts = mirror_stmts(cx, self.id, &*self.stmts);
let opt_def_id = cx.tcx.hir.opt_local_def_id(self.id);
let opt_destruction_extent = opt_def_id.and_then(|def_id| {
cx.tcx.region_maps(def_id).opt_destruction_extent(self.id)
});
let opt_destruction_extent = cx.region_maps.opt_destruction_extent(self.id);
Block {
targeted_by_break: self.targeted_by_break,
extent: CodeExtent::Misc(self.id),
Expand All @@ -42,11 +39,8 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
stmts: &'tcx [hir::Stmt])
-> Vec<StmtRef<'tcx>> {
let mut result = vec![];
let opt_def_id = cx.tcx.hir.opt_local_def_id(block_id);
for (index, stmt) in stmts.iter().enumerate() {
let opt_dxn_ext = opt_def_id.and_then(|def_id| {
cx.tcx.region_maps(def_id).opt_destruction_extent(stmt.node.id())
});
let opt_dxn_ext = cx.region_maps.opt_destruction_extent(stmt.node.id());
match stmt.node {
hir::StmtExpr(ref expr, id) |
hir::StmtSemi(ref expr, id) => {
Expand Down

0 comments on commit b8d8dc3

Please sign in to comment.