Move checked arithmetic operators into Int trait

This commit is contained in:
Brendan Zabarauskas 2014-11-10 00:11:28 +11:00
parent 7e57cd843c
commit e51cc089da
20 changed files with 324 additions and 371 deletions

View file

@ -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!")
}