Skip to content

Commit

Permalink
Update next_node_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jun 15, 2022
1 parent 52f22c7 commit 8ffbd81
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 8ffbd81

Please sign in to comment.