@@ -29,7 +29,7 @@ use util::ppaux::{Repr, UserString};
29
29
use util:: common:: { indenter} ;
30
30
31
31
use std:: cast;
32
- use std:: cell:: RefCell ;
32
+ use std:: cell:: { Cell , RefCell } ;
33
33
use std:: cmp;
34
34
use std:: hashmap:: { HashMap , HashSet } ;
35
35
use std:: ops;
@@ -265,7 +265,7 @@ pub type ctxt = @ctxt_;
265
265
struct ctxt_ {
266
266
diag : @mut syntax:: diagnostic:: span_handler ,
267
267
interner : RefCell < HashMap < intern_key , ~t_box_ > > ,
268
- next_id : @ mut uint ,
268
+ next_id : Cell < uint > ,
269
269
cstore : @metadata:: cstore:: CStore ,
270
270
sess : session:: Session ,
271
271
def_map : resolve:: DefMap ,
@@ -970,7 +970,7 @@ pub fn mk_ctxt(s: session::Session,
970
970
item_variance_map : RefCell :: new ( HashMap :: new ( ) ) ,
971
971
diag : s. diagnostic ( ) ,
972
972
interner : RefCell :: new ( HashMap :: new ( ) ) ,
973
- next_id : @ mut primitives:: LAST_PRIMITIVE_ID ,
973
+ next_id : Cell :: new ( primitives:: LAST_PRIMITIVE_ID ) ,
974
974
cstore : s. cstore ,
975
975
sess : s,
976
976
def_map : dm,
@@ -1124,7 +1124,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
1124
1124
1125
1125
let t = ~t_box_ {
1126
1126
sty : st,
1127
- id : * cx. next_id ,
1127
+ id : cx. next_id . get ( ) ,
1128
1128
flags : flags,
1129
1129
} ;
1130
1130
@@ -1137,7 +1137,7 @@ pub fn mk_t(cx: ctxt, st: sty) -> t {
1137
1137
let mut interner = cx. interner . borrow_mut ( ) ;
1138
1138
interner. get ( ) . insert ( key, t) ;
1139
1139
1140
- * cx. next_id += 1 ;
1140
+ cx. next_id . set ( cx . next_id . get ( ) + 1 ) ;
1141
1141
1142
1142
unsafe {
1143
1143
cast:: transmute :: < * sty , t > ( sty_ptr)
0 commit comments