Do not create a new NodeId when not used.
This commit is contained in:
parent
fb060fb774
commit
682f57656e
1 changed files with 6 additions and 2 deletions
|
@ -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 {
|
fn next_id(&mut self) -> hir::HirId {
|
||||||
let node_id = self.next_node_id();
|
let owner = self.current_hir_id_owner;
|
||||||
self.lower_node_id(node_id)
|
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))]
|
#[instrument(level = "trace", skip(self))]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue