1
Fork 0

librustc: De-@mut node_id in the session

This commit is contained in:
Patrick Walton 2013-12-22 14:36:50 -08:00
parent eaf69494a5
commit c56bac7f40
2 changed files with 4 additions and 4 deletions

View file

@ -881,7 +881,7 @@ pub fn build_session_(sopts: @session::options,
building_library: @mut false,
working_dir: os::getcwd(),
lints: RefCell::new(HashMap::new()),
node_id: @mut 1,
node_id: Cell::new(1),
outputs: @mut ~[],
}
}

View file

@ -214,7 +214,7 @@ pub struct Session_ {
working_dir: Path,
lints: RefCell<HashMap<ast::NodeId,
~[(lint::lint, codemap::Span, ~str)]>>,
node_id: @mut ast::NodeId,
node_id: Cell<ast::NodeId>,
outputs: @mut ~[OutputStyle],
}
@ -282,10 +282,10 @@ impl Session_ {
self.reserve_node_ids(1)
}
pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
let v = *self.node_id;
let v = self.node_id.get();
match v.checked_add(&count) {
Some(next) => { *self.node_id = next; }
Some(next) => { self.node_id.set(next); }
None => self.bug("Input too large, ran out of node ids!")
}