Skip to content

Commit 8ffbd81

Browse files
committed
Update next_node_id.
1 parent 52f22c7 commit 8ffbd81

File tree

1 file changed

+4
-7
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+4
-7
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -496,13 +496,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
496496
}
497497

498498
fn next_node_id(&mut self) -> NodeId {
499-
let next = self
500-
.next_node_id
501-
.as_usize()
502-
.checked_add(1)
503-
.expect("input too large; ran out of NodeIds");
504-
self.next_node_id = NodeId::from_usize(next);
505-
self.next_node_id
499+
let start = self.next_node_id;
500+
let next = start.as_u32().checked_add(1).expect("input too large; ran out of NodeIds");
501+
self.next_node_id = ast::NodeId::from_u32(next);
502+
start
506503
}
507504

508505
fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> {

0 commit comments

Comments
 (0)