diff --git a/compiler/rustc_ast_lowering/src/block.rs b/compiler/rustc_ast_lowering/src/block.rs index 8e02cbfd2ca..20d3ce65fac 100644 --- a/compiler/rustc_ast_lowering/src/block.rs +++ b/compiler/rustc_ast_lowering/src/block.rs @@ -14,15 +14,6 @@ pub(super) fn lower_block( self.arena.alloc(self.lower_block_noalloc(hir_id, b, targeted_by_break)) } - pub(super) fn lower_block_with_hir_id( - &mut self, - b: &Block, - hir_id: hir::HirId, - targeted_by_break: bool, - ) -> &'hir hir::Block<'hir> { - self.arena.alloc(self.lower_block_noalloc(hir_id, b, targeted_by_break)) - } - pub(super) fn lower_block_noalloc( &mut self, hir_id: hir::HirId, diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index 37eea707929..70c94f4019a 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -260,7 +260,7 @@ fn lower_delegation_body( }; self_resolver.visit_block(block); // Target expr needs to lower `self` path. - this.ident_to_local_id.insert(pat_node_id, param.pat.hir_id.local_id); + this.ident_and_label_to_local_id.insert(pat_node_id, param.pat.hir_id.local_id); this.lower_target_expr(&block) } else { this.generate_arg(param.pat.hir_id, span) diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index 3df945a18e8..d986c4b412f 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -261,10 +261,12 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> { // expr node id. let block_hir_id = self.lower_node_id(blk.id); let opt_label = self.lower_label(*opt_label, blk.id, block_hir_id); - hir::ExprKind::Block( - self.lower_block_with_hir_id(blk, block_hir_id, opt_label.is_some()), - opt_label, - ) + let hir_block = self.arena.alloc(self.lower_block_noalloc( + block_hir_id, + blk, + opt_label.is_some(), + )); + hir::ExprKind::Block(hir_block, opt_label) } ExprKind::Assign(el, er, span) => self.lower_expr_assign(el, er, *span, e.span), ExprKind::AssignOp(op, el, er) => hir::ExprKind::AssignOp( @@ -1486,7 +1488,7 @@ fn lower_label( dest_hir_id: hir::HirId, ) -> Option