Update next_node_id.

This commit is contained in:
Camille GILLOT 2022-06-15 19:41:41 +02:00
parent 52f22c7d01
commit 8ffbd814af

View File

@ -496,13 +496,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
} }
fn next_node_id(&mut self) -> NodeId { fn next_node_id(&mut self) -> NodeId {
let next = self let start = self.next_node_id;
.next_node_id let next = start.as_u32().checked_add(1).expect("input too large; ran out of NodeIds");
.as_usize() self.next_node_id = ast::NodeId::from_u32(next);
.checked_add(1) start
.expect("input too large; ran out of NodeIds");
self.next_node_id = NodeId::from_usize(next);
self.next_node_id
} }
fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> { fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> {