diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-15 19:41:41 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-15 19:41:41 +0200 |
| commit | 8ffbd814afd5bcb0534eef7d69af8df3a641d3ec (patch) | |
| tree | 31b9fedb367a4406d77c2bf454b4d4d270324c9a /compiler | |
| parent | 52f22c7d01f68c6015fca73dc3623040d6a5dc9d (diff) | |
| download | rust-8ffbd814afd5bcb0534eef7d69af8df3a641d3ec.tar.gz rust-8ffbd814afd5bcb0534eef7d69af8df3a641d3ec.zip | |
Update next_node_id.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index d56b2fd5d0b..ec1a48a91c5 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -496,13 +496,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } fn next_node_id(&mut self) -> NodeId { - let next = self - .next_node_id - .as_usize() - .checked_add(1) - .expect("input too large; ran out of NodeIds"); - self.next_node_id = NodeId::from_usize(next); - self.next_node_id + let start = self.next_node_id; + let next = start.as_u32().checked_add(1).expect("input too large; ran out of NodeIds"); + self.next_node_id = ast::NodeId::from_u32(next); + start } fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> { |
