@@ -90,8 +90,8 @@ pub struct RegionVarBindings {
90
90
tcx : ty:: ctxt ,
91
91
var_origins : ~[ RegionVariableOrigin ] ,
92
92
constraints : RefCell < HashMap < Constraint , SubregionOrigin > > ,
93
- lubs : CombineMap ,
94
- glbs : CombineMap ,
93
+ lubs : RefCell < CombineMap > ,
94
+ glbs : RefCell < CombineMap > ,
95
95
skolemization_count : Cell < uint > ,
96
96
bound_count : Cell < uint > ,
97
97
@@ -116,8 +116,8 @@ pub fn RegionVarBindings(tcx: ty::ctxt) -> RegionVarBindings {
116
116
var_origins : ~[ ] ,
117
117
values : None ,
118
118
constraints : RefCell :: new ( HashMap :: new ( ) ) ,
119
- lubs : HashMap :: new ( ) ,
120
- glbs : HashMap :: new ( ) ,
119
+ lubs : RefCell :: new ( HashMap :: new ( ) ) ,
120
+ glbs : RefCell :: new ( HashMap :: new ( ) ) ,
121
121
skolemization_count : Cell :: new ( 0 ) ,
122
122
bound_count : Cell :: new ( 0 ) ,
123
123
undo_log : ~[ ]
@@ -162,10 +162,12 @@ impl RegionVarBindings {
162
162
constraints. get ( ) . remove ( constraint) ;
163
163
}
164
164
AddCombination ( Glb , ref regions) => {
165
- self . glbs . remove ( regions) ;
165
+ let mut glbs = self . glbs . borrow_mut ( ) ;
166
+ glbs. get ( ) . remove ( regions) ;
166
167
}
167
168
AddCombination ( Lub , ref regions) => {
168
- self . lubs . remove ( regions) ;
169
+ let mut lubs = self . lubs . borrow_mut ( ) ;
170
+ lubs. get ( ) . remove ( regions) ;
169
171
}
170
172
}
171
173
}
@@ -345,10 +347,8 @@ impl RegionVarBindings {
345
347
}
346
348
}
347
349
348
- fn combine_map < ' a > ( & ' a mut self ,
349
- t : CombineMapType )
350
- -> & ' a mut CombineMap
351
- {
350
+ fn combine_map < ' a > ( & ' a mut self , t : CombineMapType )
351
+ -> & ' a mut RefCell < CombineMap > {
352
352
match t {
353
353
Glb => & mut self . glbs ,
354
354
Lub => & mut self . lubs ,
@@ -365,14 +365,20 @@ impl RegionVarBindings {
365
365
new_r : Region |)
366
366
-> Region {
367
367
let vars = TwoRegions { a : a, b : b } ;
368
- match self . combine_map ( t) . find ( & vars) {
369
- Some ( & c) => {
370
- return ReInfer ( ReVar ( c) ) ;
368
+ {
369
+ let map = self . combine_map ( t) . borrow ( ) ;
370
+ match map. get ( ) . find ( & vars) {
371
+ Some ( & c) => {
372
+ return ReInfer ( ReVar ( c) ) ;
373
+ }
374
+ None => { }
371
375
}
372
- None => { }
373
376
}
374
377
let c = self . new_region_var ( infer:: MiscVariable ( origin. span ( ) ) ) ;
375
- self . combine_map ( t) . insert ( vars, c) ;
378
+ {
379
+ let mut map = self . combine_map ( t) . borrow_mut ( ) ;
380
+ map. get ( ) . insert ( vars, c) ;
381
+ }
376
382
if self . in_snapshot ( ) {
377
383
self . undo_log . push ( AddCombination ( t, vars) ) ;
378
384
}
0 commit comments