@@ -364,7 +364,7 @@ struct ctxt_ {
364
364
365
365
// The set of external traits whose implementations have been read. This
366
366
// is used for lazy resolution of traits.
367
- populated_external_traits : @ mut HashSet < ast:: DefId > ,
367
+ populated_external_traits : RefCell < HashSet < ast:: DefId > > ,
368
368
369
369
// These two caches are used by const_eval when decoding external statics
370
370
// and variants that are found.
@@ -1008,7 +1008,7 @@ pub fn mk_ctxt(s: session::Session,
1008
1008
used_mut_nodes : RefCell :: new ( HashSet :: new ( ) ) ,
1009
1009
impl_vtables : RefCell :: new ( HashMap :: new ( ) ) ,
1010
1010
populated_external_types : RefCell :: new ( HashSet :: new ( ) ) ,
1011
- populated_external_traits : @ mut HashSet :: new ( ) ,
1011
+ populated_external_traits : RefCell :: new ( HashSet :: new ( ) ) ,
1012
1012
1013
1013
extern_const_statics : RefCell :: new ( HashMap :: new ( ) ) ,
1014
1014
extern_const_variants : RefCell :: new ( HashMap :: new ( ) ) ,
@@ -4589,8 +4589,12 @@ pub fn populate_implementations_for_trait_if_necessary(
4589
4589
if trait_id. crate == LOCAL_CRATE {
4590
4590
return
4591
4591
}
4592
- if tcx. populated_external_traits . contains ( & trait_id) {
4593
- return
4592
+ {
4593
+ let populated_external_traits = tcx. populated_external_traits
4594
+ . borrow ( ) ;
4595
+ if populated_external_traits. get ( ) . contains ( & trait_id) {
4596
+ return
4597
+ }
4594
4598
}
4595
4599
4596
4600
csearch:: each_implementation_for_trait ( tcx. sess . cstore , trait_id,
@@ -4615,7 +4619,9 @@ pub fn populate_implementations_for_trait_if_necessary(
4615
4619
impls. get ( ) . insert ( implementation_def_id, implementation) ;
4616
4620
} ) ;
4617
4621
4618
- tcx. populated_external_traits . insert ( trait_id) ;
4622
+ let mut populated_external_traits = tcx. populated_external_traits
4623
+ . borrow_mut ( ) ;
4624
+ populated_external_traits. get ( ) . insert ( trait_id) ;
4619
4625
}
4620
4626
4621
4627
/// Given the def_id of an impl, return the def_id of the trait it implements.
0 commit comments