diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-04-02 16:13:20 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-07-06 23:10:36 +0200 |
| commit | 682f57656ed83c1017ad7288940280386f80efae (patch) | |
| tree | fa1498c67a33433630bd86b63c7765937a10241f /compiler/rustc_ast_lowering/src | |
| parent | fb060fb774c7e0f1e06dfb43c6173bc37079dfcd (diff) | |
| download | rust-682f57656ed83c1017ad7288940280386f80efae.tar.gz rust-682f57656ed83c1017ad7288940280386f80efae.zip | |
Do not create a new NodeId when not used.
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 62682e837dc..4e90bad2c0a 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -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))] |
