@@ -57,7 +57,7 @@ use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap,
57
57
StableVec } ;
58
58
use arena:: { TypedArena , DroplessArena } ;
59
59
use rustc_data_structures:: indexed_vec:: IndexVec ;
60
- use rustc_data_structures:: sync:: Lrc ;
60
+ use rustc_data_structures:: sync:: { Lrc , Lock } ;
61
61
use std:: any:: Any ;
62
62
use std:: borrow:: Borrow ;
63
63
use std:: cell:: { Cell , RefCell } ;
@@ -130,28 +130,28 @@ pub struct CtxtInterners<'tcx> {
130
130
131
131
/// Specifically use a speedy hash algorithm for these hash sets,
132
132
/// they're accessed quite often.
133
- type_ : RefCell < FxHashSet < Interned < ' tcx , TyS < ' tcx > > > > ,
134
- type_list : RefCell < FxHashSet < Interned < ' tcx , Slice < Ty < ' tcx > > > > > ,
135
- substs : RefCell < FxHashSet < Interned < ' tcx , Substs < ' tcx > > > > ,
136
- canonical_var_infos : RefCell < FxHashSet < Interned < ' tcx , Slice < CanonicalVarInfo > > > > ,
137
- region : RefCell < FxHashSet < Interned < ' tcx , RegionKind > > > ,
138
- existential_predicates : RefCell < FxHashSet < Interned < ' tcx , Slice < ExistentialPredicate < ' tcx > > > > > ,
139
- predicates : RefCell < FxHashSet < Interned < ' tcx , Slice < Predicate < ' tcx > > > > > ,
140
- const_ : RefCell < FxHashSet < Interned < ' tcx , Const < ' tcx > > > > ,
133
+ type_ : Lock < FxHashSet < Interned < ' tcx , TyS < ' tcx > > > > ,
134
+ type_list : Lock < FxHashSet < Interned < ' tcx , Slice < Ty < ' tcx > > > > > ,
135
+ substs : Lock < FxHashSet < Interned < ' tcx , Substs < ' tcx > > > > ,
136
+ canonical_var_infos : Lock < FxHashSet < Interned < ' tcx , Slice < CanonicalVarInfo > > > > ,
137
+ region : Lock < FxHashSet < Interned < ' tcx , RegionKind > > > ,
138
+ existential_predicates : Lock < FxHashSet < Interned < ' tcx , Slice < ExistentialPredicate < ' tcx > > > > > ,
139
+ predicates : Lock < FxHashSet < Interned < ' tcx , Slice < Predicate < ' tcx > > > > > ,
140
+ const_ : Lock < FxHashSet < Interned < ' tcx , Const < ' tcx > > > > ,
141
141
}
142
142
143
143
impl < ' gcx : ' tcx , ' tcx > CtxtInterners < ' tcx > {
144
144
fn new ( arena : & ' tcx DroplessArena ) -> CtxtInterners < ' tcx > {
145
145
CtxtInterners {
146
- arena,
147
- type_ : RefCell :: new ( FxHashSet ( ) ) ,
148
- type_list : RefCell :: new ( FxHashSet ( ) ) ,
149
- substs : RefCell :: new ( FxHashSet ( ) ) ,
150
- region : RefCell :: new ( FxHashSet ( ) ) ,
151
- existential_predicates : RefCell :: new ( FxHashSet ( ) ) ,
152
- canonical_var_infos : RefCell :: new ( FxHashSet ( ) ) ,
153
- predicates : RefCell :: new ( FxHashSet ( ) ) ,
154
- const_ : RefCell :: new ( FxHashSet ( ) ) ,
146
+ arena : arena ,
147
+ type_ : Lock :: new ( FxHashSet ( ) ) ,
148
+ type_list : Lock :: new ( FxHashSet ( ) ) ,
149
+ substs : Lock :: new ( FxHashSet ( ) ) ,
150
+ canonical_var_infos : Lock :: new ( FxHashSet ( ) ) ,
151
+ region : Lock :: new ( FxHashSet ( ) ) ,
152
+ existential_predicates : Lock :: new ( FxHashSet ( ) ) ,
153
+ predicates : Lock :: new ( FxHashSet ( ) ) ,
154
+ const_ : Lock :: new ( FxHashSet ( ) ) ,
155
155
}
156
156
}
157
157
@@ -891,11 +891,11 @@ pub struct GlobalCtxt<'tcx> {
891
891
/// by `proc-macro` crates.
892
892
pub derive_macros : RefCell < NodeMap < Symbol > > ,
893
893
894
- stability_interner : RefCell < FxHashSet < & ' tcx attr:: Stability > > ,
894
+ stability_interner : Lock < FxHashSet < & ' tcx attr:: Stability > > ,
895
895
896
896
pub interpret_interner : InterpretInterner < ' tcx > ,
897
897
898
- layout_interner : RefCell < FxHashSet < & ' tcx LayoutDetails > > ,
898
+ layout_interner : Lock < FxHashSet < & ' tcx LayoutDetails > > ,
899
899
900
900
/// A vector of every trait accessible in the whole crate
901
901
/// (i.e. including those from subcrates). This is used only for
@@ -917,7 +917,7 @@ pub struct GlobalCtxt<'tcx> {
917
917
/// Everything needed to efficiently work with interned allocations
918
918
#[ derive( Debug , Default ) ]
919
919
pub struct InterpretInterner < ' tcx > {
920
- inner : RefCell < InterpretInternerInner < ' tcx > > ,
920
+ inner : Lock < InterpretInternerInner < ' tcx > > ,
921
921
}
922
922
923
923
#[ derive( Debug , Default ) ]
@@ -1277,10 +1277,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1277
1277
evaluation_cache : traits:: EvaluationCache :: new ( ) ,
1278
1278
crate_name : Symbol :: intern ( crate_name) ,
1279
1279
data_layout,
1280
- layout_interner : RefCell :: new ( FxHashSet ( ) ) ,
1280
+ layout_interner : Lock :: new ( FxHashSet ( ) ) ,
1281
1281
layout_depth : Cell :: new ( 0 ) ,
1282
1282
derive_macros : RefCell :: new ( NodeMap ( ) ) ,
1283
- stability_interner : RefCell :: new ( FxHashSet ( ) ) ,
1283
+ stability_interner : Lock :: new ( FxHashSet ( ) ) ,
1284
1284
interpret_interner : Default :: default ( ) ,
1285
1285
all_traits : RefCell :: new ( None ) ,
1286
1286
tx_to_llvm_workers : tx,
0 commit comments