Skip to content

Commit fa437f4

Browse files
committed
do not consult union-find during fudge_regions_if_ok
1 parent 7832db8 commit fa437f4

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

src/librustc/infer/fudge.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,11 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> {
135135
ty
136136
}
137137

138-
Some(info) => {
138+
Some(&origin) => {
139139
// This variable was created during the
140-
// fudging; it was mapped the root
141-
// `root_vid`. There are now two
142-
// possibilities: either the root was creating
143-
// during the fudging too, in which case we
144-
// want a fresh variable, or it was not, in
145-
// which case we can return it.
146-
if self.type_variables.contains_key(&info.root_vid) {
147-
self.infcx.next_ty_var(info.root_origin)
148-
} else {
149-
self.infcx.tcx.mk_var(info.root_vid)
150-
}
140+
// fudging. Recreate it with a fresh variable
141+
// here.
142+
self.infcx.next_ty_var(origin)
151143
}
152144
}
153145
}

src/librustc/infer/type_variable.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,7 @@ pub enum TypeVariableOrigin {
6767
Generalized(ty::TyVid),
6868
}
6969

70-
pub type TypeVariableMap = FxHashMap<ty::TyVid, TypeVariableInfo>;
71-
72-
pub struct TypeVariableInfo {
73-
pub root_vid: ty::TyVid,
74-
pub root_origin: TypeVariableOrigin,
75-
}
70+
pub type TypeVariableMap = FxHashMap<ty::TyVid, TypeVariableOrigin>;
7671

7772
struct TypeVariableData<'tcx> {
7873
value: TypeVariableValue<'tcx>,
@@ -294,8 +289,6 @@ impl<'tcx> TypeVariableTable<'tcx> {
294289
/// along with their origin.
295290
pub fn types_created_since_snapshot(&mut self, s: &Snapshot) -> TypeVariableMap {
296291
let actions_since_snapshot = self.values.actions_since_snapshot(&s.snapshot);
297-
let eq_relations = &mut self.eq_relations;
298-
let values = &self.values;
299292

300293
actions_since_snapshot
301294
.iter()
@@ -304,9 +297,8 @@ impl<'tcx> TypeVariableTable<'tcx> {
304297
_ => None,
305298
})
306299
.map(|vid| {
307-
let root_vid = eq_relations.find(vid);
308-
let root_origin = values.get(vid.index as usize).origin.clone();
309-
(vid, TypeVariableInfo { root_vid, root_origin })
300+
let origin = self.values.get(vid.index as usize).origin.clone();
301+
(vid, origin)
310302
})
311303
.collect()
312304
}

0 commit comments

Comments
 (0)