Skip to content

Commit 89dfd00

Browse files
committed
librustc: De-@mut next_id in the type context
1 parent a483ee8 commit 89dfd00

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc/middle/ty.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use util::ppaux::{Repr, UserString};
2929
use util::common::{indenter};
3030

3131
use std::cast;
32-
use std::cell::RefCell;
32+
use std::cell::{Cell, RefCell};
3333
use std::cmp;
3434
use std::hashmap::{HashMap, HashSet};
3535
use std::ops;
@@ -265,7 +265,7 @@ pub type ctxt = @ctxt_;
265265
struct ctxt_ {
266266
diag: @mut syntax::diagnostic::span_handler,
267267
interner: RefCell<HashMap<intern_key, ~t_box_>>,
268-
next_id: @mut uint,
268+
next_id: Cell<uint>,
269269
cstore: @metadata::cstore::CStore,
270270
sess: session::Session,
271271
def_map: resolve::DefMap,
@@ -970,7 +970,7 @@ pub fn mk_ctxt(s: session::Session,
970970
item_variance_map: RefCell::new(HashMap::new()),
971971
diag: s.diagnostic(),
972972
interner: RefCell::new(HashMap::new()),
973-
next_id: @mut primitives::LAST_PRIMITIVE_ID,
973+
next_id: Cell::new(primitives::LAST_PRIMITIVE_ID),
974974
cstore: s.cstore,
975975
sess: s,
976976
def_map: dm,
@@ -1124,7 +1124,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
11241124

11251125
let t = ~t_box_ {
11261126
sty: st,
1127-
id: *cx.next_id,
1127+
id: cx.next_id.get(),
11281128
flags: flags,
11291129
};
11301130

@@ -1137,7 +1137,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
11371137
let mut interner = cx.interner.borrow_mut();
11381138
interner.get().insert(key, t);
11391139

1140-
*cx.next_id += 1;
1140+
cx.next_id.set(cx.next_id.get() + 1);
11411141

11421142
unsafe {
11431143
cast::transmute::<*sty, t>(sty_ptr)

0 commit comments

Comments
 (0)