Skip to content

Commit 9d6214f

Browse files
committed
Do not create a new NodeId when not used.
1 parent 2341f21 commit 9d6214f

File tree

1 file changed

+6
-2
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+6
-2
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,13 @@ impl<'hir> LoweringContext<'hir> {
646646
}
647647
}
648648

649+
/// Generate a new `HirId` without a backing `NodeId`.
649650
fn next_id(&mut self) -> hir::HirId {
650-
let node_id = self.next_node_id();
651-
self.lower_node_id(node_id)
651+
let owner = self.current_hir_id_owner;
652+
let local_id = self.item_local_id_counter;
653+
assert_ne!(local_id, hir::ItemLocalId::new(0));
654+
self.item_local_id_counter.increment_by(1);
655+
hir::HirId { owner, local_id }
652656
}
653657

654658
fn lower_res(&mut self, res: Res<NodeId>) -> Res {

0 commit comments

Comments
 (0)