@@ -293,7 +293,7 @@ struct ctxt_ {
293
293
trait_method_def_ids : RefCell < HashMap < DefId , @~[ DefId ] > > ,
294
294
295
295
// A cache for the trait_methods() routine
296
- trait_methods_cache : @ mut HashMap < DefId , @~[ @Method ] > ,
296
+ trait_methods_cache : RefCell < HashMap < DefId , @~[ @Method ] > > ,
297
297
298
298
impl_trait_cache : @mut HashMap < ast:: DefId , Option < @ty:: TraitRef > > ,
299
299
@@ -1000,7 +1000,7 @@ pub fn mk_ctxt(s: session::Session,
1000
1000
enum_var_cache : @mut HashMap :: new ( ) ,
1001
1001
methods : RefCell :: new ( HashMap :: new ( ) ) ,
1002
1002
trait_method_def_ids : RefCell :: new ( HashMap :: new ( ) ) ,
1003
- trait_methods_cache : @ mut HashMap :: new ( ) ,
1003
+ trait_methods_cache : RefCell :: new ( HashMap :: new ( ) ) ,
1004
1004
impl_trait_cache : @mut HashMap :: new ( ) ,
1005
1005
ty_param_defs : @mut HashMap :: new ( ) ,
1006
1006
adjustments : @mut HashMap :: new ( ) ,
@@ -3591,12 +3591,13 @@ pub fn trait_method(cx: ctxt, trait_did: ast::DefId, idx: uint) -> @Method {
3591
3591
3592
3592
3593
3593
pub fn trait_methods ( cx : ctxt , trait_did : ast:: DefId ) -> @~[ @Method ] {
3594
- match cx. trait_methods_cache . find ( & trait_did) {
3594
+ let mut trait_methods_cache = cx. trait_methods_cache . borrow_mut ( ) ;
3595
+ match trait_methods_cache. get ( ) . find ( & trait_did) {
3595
3596
Some ( & methods) => methods,
3596
3597
None => {
3597
3598
let def_ids = ty:: trait_method_def_ids ( cx, trait_did) ;
3598
3599
let methods = @def_ids. map ( |d| ty:: method ( cx, * d) ) ;
3599
- cx . trait_methods_cache . insert ( trait_did, methods) ;
3600
+ trait_methods_cache. get ( ) . insert ( trait_did, methods) ;
3600
3601
methods
3601
3602
}
3602
3603
}
0 commit comments