Skip to content

Commit c56bac7

Browse files
committed
librustc: De-@mut node_id in the session
1 parent eaf6949 commit c56bac7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ pub fn build_session_(sopts: @session::options,
881881
building_library: @mut false,
882882
working_dir: os::getcwd(),
883883
lints: RefCell::new(HashMap::new()),
884-
node_id: @mut 1,
884+
node_id: Cell::new(1),
885885
outputs: @mut ~[],
886886
}
887887
}

src/librustc/driver/session.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub struct Session_ {
214214
working_dir: Path,
215215
lints: RefCell<HashMap<ast::NodeId,
216216
~[(lint::lint, codemap::Span, ~str)]>>,
217-
node_id: @mut ast::NodeId,
217+
node_id: Cell<ast::NodeId>,
218218
outputs: @mut ~[OutputStyle],
219219
}
220220

@@ -282,10 +282,10 @@ impl Session_ {
282282
self.reserve_node_ids(1)
283283
}
284284
pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
285-
let v = *self.node_id;
285+
let v = self.node_id.get();
286286

287287
match v.checked_add(&count) {
288-
Some(next) => { *self.node_id = next; }
288+
Some(next) => { self.node_id.set(next); }
289289
None => self.bug("Input too large, ran out of node ids!")
290290
}
291291

0 commit comments

Comments
 (0)