Skip to content

Commit fa97590

Browse files
committed
---
yaml --- r: 88959 b: refs/heads/snap-stage3 c: b84f294 h: refs/heads/master i: 88957: 374ee86 88955: 352f92e 88951: e98fd1d 88943: ca3d1fb 88927: cd490c2 88895: 7739a64 88831: b60752b v: v3
1 parent 3a5a18a commit fa97590

File tree

2 files changed

+22
-16
lines changed
  • branches/snap-stage3/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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bdfd0b5ae081240697fb087f59c42ab9ba070bef
4+
refs/heads/snap-stage3: b84f294c4672018e237e8196eef59bb668b805f2
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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)