Skip to content

Commit 682f576

Browse files
committed
Do not create a new NodeId when not used.
1 parent fb060fb commit 682f576

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
635635
}
636636
}
637637

638+
/// Generate a new `HirId` without a backing `NodeId`.
638639
fn next_id(&mut self) -> hir::HirId {
639-
let node_id = self.next_node_id();
640-
self.lower_node_id(node_id)
640+
let owner = self.current_hir_id_owner;
641+
let local_id = self.item_local_id_counter;
642+
assert_ne!(local_id, hir::ItemLocalId::new(0));
643+
self.item_local_id_counter.increment_by(1);
644+
hir::HirId { owner, local_id }
641645
}
642646

643647
#[instrument(level = "trace", skip(self))]

0 commit comments

Comments
 (0)