Move checked arithmetic operators into Int trait
This commit is contained in:
parent
7e57cd843c
commit
e51cc089da
20 changed files with 324 additions and 371 deletions
|
@ -63,7 +63,7 @@ impl ParseSess {
|
|||
pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
|
||||
let v = self.node_id.get();
|
||||
|
||||
match v.checked_add(&count) {
|
||||
match v.checked_add(count) {
|
||||
Some(next) => { self.node_id.set(next); }
|
||||
None => panic!("Input too large, ran out of node ids!")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue