Skip to content

Commit e26152c

Browse files
committed
---
yaml --- r: 147575 b: refs/heads/try2 c: b84f294 h: refs/heads/master i: 147573: 876a236 147571: 441a6c0 147567: ae1d187 v: v3
1 parent 0717889 commit e26152c

File tree

2 files changed

+22
-16
lines changed
  • branches/try2/src/librustc/middle/typeck/infer/region_inference

2 files changed

+22
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: bdfd0b5ae081240697fb087f59c42ab9ba070bef
8+
refs/heads/try2: b84f294c4672018e237e8196eef59bb668b805f2
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/typeck/infer/region_inference/mod.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ pub struct RegionVarBindings {
9090
tcx: ty::ctxt,
9191
var_origins: ~[RegionVariableOrigin],
9292
constraints: RefCell<HashMap<Constraint, SubregionOrigin>>,
93-
lubs: CombineMap,
94-
glbs: CombineMap,
93+
lubs: RefCell<CombineMap>,
94+
glbs: RefCell<CombineMap>,
9595
skolemization_count: Cell<uint>,
9696
bound_count: Cell<uint>,
9797

@@ -116,8 +116,8 @@ pub fn RegionVarBindings(tcx: ty::ctxt) -> RegionVarBindings {
116116
var_origins: ~[],
117117
values: None,
118118
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()),
121121
skolemization_count: Cell::new(0),
122122
bound_count: Cell::new(0),
123123
undo_log: ~[]
@@ -162,10 +162,12 @@ impl RegionVarBindings {
162162
constraints.get().remove(constraint);
163163
}
164164
AddCombination(Glb, ref regions) => {
165-
self.glbs.remove(regions);
165+
let mut glbs = self.glbs.borrow_mut();
166+
glbs.get().remove(regions);
166167
}
167168
AddCombination(Lub, ref regions) => {
168-
self.lubs.remove(regions);
169+
let mut lubs = self.lubs.borrow_mut();
170+
lubs.get().remove(regions);
169171
}
170172
}
171173
}
@@ -345,10 +347,8 @@ impl RegionVarBindings {
345347
}
346348
}
347349

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> {
352352
match t {
353353
Glb => &mut self.glbs,
354354
Lub => &mut self.lubs,
@@ -365,14 +365,20 @@ impl RegionVarBindings {
365365
new_r: Region|)
366366
-> Region {
367367
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 => {}
371375
}
372-
None => {}
373376
}
374377
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+
}
376382
if self.in_snapshot() {
377383
self.undo_log.push(AddCombination(t, vars));
378384
}

0 commit comments

Comments
 (0)