Skip to content

Commit b8d8dc3

Browse files
committed
Fix #43457 (and avoid some unneeded lookups to boot, woo).
1 parent 6722996 commit b8d8dc3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/librustc_mir/hair/cx/block.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block {
2222
// We have to eagerly translate the "spine" of the statements
2323
// in order to get the lexical scoping correctly.
2424
let stmts = mirror_stmts(cx, self.id, &*self.stmts);
25-
let opt_def_id = cx.tcx.hir.opt_local_def_id(self.id);
26-
let opt_destruction_extent = opt_def_id.and_then(|def_id| {
27-
cx.tcx.region_maps(def_id).opt_destruction_extent(self.id)
28-
});
25+
let opt_destruction_extent = cx.region_maps.opt_destruction_extent(self.id);
2926
Block {
3027
targeted_by_break: self.targeted_by_break,
3128
extent: CodeExtent::Misc(self.id),
@@ -42,11 +39,8 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
4239
stmts: &'tcx [hir::Stmt])
4340
-> Vec<StmtRef<'tcx>> {
4441
let mut result = vec![];
45-
let opt_def_id = cx.tcx.hir.opt_local_def_id(block_id);
4642
for (index, stmt) in stmts.iter().enumerate() {
47-
let opt_dxn_ext = opt_def_id.and_then(|def_id| {
48-
cx.tcx.region_maps(def_id).opt_destruction_extent(stmt.node.id())
49-
});
43+
let opt_dxn_ext = cx.region_maps.opt_destruction_extent(stmt.node.id());
5044
match stmt.node {
5145
hir::StmtExpr(ref expr, id) |
5246
hir::StmtSemi(ref expr, id) => {

0 commit comments

Comments
 (0)