1
Fork 0

Do not create a new NodeId when not used.

This commit is contained in:
Camille GILLOT 2022-04-02 16:13:20 +02:00
parent fb060fb774
commit 682f57656e

View file

@ -635,9 +635,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
}
}
/// Generate a new `HirId` without a backing `NodeId`.
fn next_id(&mut self) -> hir::HirId {
let node_id = self.next_node_id();
self.lower_node_id(node_id)
let owner = self.current_hir_id_owner;
let local_id = self.item_local_id_counter;
assert_ne!(local_id, hir::ItemLocalId::new(0));
self.item_local_id_counter.increment_by(1);
hir::HirId { owner, local_id }
}
#[instrument(level = "trace", skip(self))]