Skip to content

Commit

Permalink
librustc: De-@mut node_id in the session
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed Dec 26, 2013
1 parent eaf6949 commit c56bac7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ~[],
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/driver/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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],
}

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

Expand Down

0 comments on commit c56bac7

Please sign in to comment.