@@ -316,7 +316,7 @@ struct ctxt_ {
316
316
normalized_cache : @mut HashMap < t , t > ,
317
317
lang_items : middle:: lang_items:: LanguageItems ,
318
318
// A mapping of fake provided method def_ids to the default implementation
319
- provided_method_sources : @ mut HashMap < ast:: DefId , ast:: DefId > ,
319
+ provided_method_sources : RefCell < HashMap < ast:: DefId , ast:: DefId > > ,
320
320
supertraits : @mut HashMap < ast:: DefId , @~[ @TraitRef ] > ,
321
321
322
322
// Maps from def-id of a type or region parameter to its
@@ -1005,7 +1005,7 @@ pub fn mk_ctxt(s: session::Session,
1005
1005
adjustments : RefCell :: new ( HashMap :: new ( ) ) ,
1006
1006
normalized_cache : new_ty_hash ( ) ,
1007
1007
lang_items : lang_items,
1008
- provided_method_sources : @ mut HashMap :: new ( ) ,
1008
+ provided_method_sources : RefCell :: new ( HashMap :: new ( ) ) ,
1009
1009
supertraits : @mut HashMap :: new ( ) ,
1010
1010
destructor_for_type : @mut HashMap :: new ( ) ,
1011
1011
destructors : @mut HashSet :: new ( ) ,
@@ -3530,7 +3530,8 @@ pub fn def_has_ty_params(def: ast::Def) -> bool {
3530
3530
}
3531
3531
3532
3532
pub fn provided_source ( cx : ctxt , id : ast:: DefId ) -> Option < ast:: DefId > {
3533
- cx. provided_method_sources . find ( & id) . map ( |x| * x)
3533
+ let provided_method_sources = cx. provided_method_sources . borrow ( ) ;
3534
+ provided_method_sources. get ( ) . find ( & id) . map ( |x| * x)
3534
3535
}
3535
3536
3536
3537
pub fn provided_trait_methods ( cx : ctxt , id : ast:: DefId ) -> ~[ @Method ] {
@@ -4531,7 +4532,9 @@ pub fn populate_implementations_for_type_if_necessary(tcx: ctxt,
4531
4532
// the map. This is a bit unfortunate.
4532
4533
for method in implementation. methods . iter ( ) {
4533
4534
for source in method. provided_source . iter ( ) {
4534
- tcx. provided_method_sources . insert ( method. def_id , * source) ;
4535
+ let mut provided_method_sources =
4536
+ tcx. provided_method_sources . borrow_mut ( ) ;
4537
+ provided_method_sources. get ( ) . insert ( method. def_id , * source) ;
4535
4538
}
4536
4539
}
4537
4540
@@ -4580,7 +4583,9 @@ pub fn populate_implementations_for_trait_if_necessary(
4580
4583
// the map. This is a bit unfortunate.
4581
4584
for method in implementation. methods . iter ( ) {
4582
4585
for source in method. provided_source . iter ( ) {
4583
- tcx. provided_method_sources . insert ( method. def_id , * source) ;
4586
+ let mut provided_method_sources =
4587
+ tcx. provided_method_sources . borrow_mut ( ) ;
4588
+ provided_method_sources. get ( ) . insert ( method. def_id , * source) ;
4584
4589
}
4585
4590
}
4586
4591
0 commit comments