do not consult union-find during fudge_regions_if_ok

This commit is contained in:
Niko Matsakis 2017-04-12 12:36:43 -04:00
parent 7832db8031
commit fa437f49af
2 changed files with 7 additions and 23 deletions

View File

@ -135,19 +135,11 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> {
ty
}
Some(info) => {
Some(&origin) => {
// This variable was created during the
// fudging; it was mapped the root
// `root_vid`. There are now two
// possibilities: either the root was creating
// during the fudging too, in which case we
// want a fresh variable, or it was not, in
// which case we can return it.
if self.type_variables.contains_key(&info.root_vid) {
self.infcx.next_ty_var(info.root_origin)
} else {
self.infcx.tcx.mk_var(info.root_vid)
}
// fudging. Recreate it with a fresh variable
// here.
self.infcx.next_ty_var(origin)
}
}
}

View File

@ -67,12 +67,7 @@ pub enum TypeVariableOrigin {
Generalized(ty::TyVid),
}
pub type TypeVariableMap = FxHashMap<ty::TyVid, TypeVariableInfo>;
pub struct TypeVariableInfo {
pub root_vid: ty::TyVid,
pub root_origin: TypeVariableOrigin,
}
pub type TypeVariableMap = FxHashMap<ty::TyVid, TypeVariableOrigin>;
struct TypeVariableData<'tcx> {
value: TypeVariableValue<'tcx>,
@ -294,8 +289,6 @@ impl<'tcx> TypeVariableTable<'tcx> {
/// along with their origin.
pub fn types_created_since_snapshot(&mut self, s: &Snapshot) -> TypeVariableMap {
let actions_since_snapshot = self.values.actions_since_snapshot(&s.snapshot);
let eq_relations = &mut self.eq_relations;
let values = &self.values;
actions_since_snapshot
.iter()
@ -304,9 +297,8 @@ impl<'tcx> TypeVariableTable<'tcx> {
_ => None,
})
.map(|vid| {
let root_vid = eq_relations.find(vid);
let root_origin = values.get(vid.index as usize).origin.clone();
(vid, TypeVariableInfo { root_vid, root_origin })
let origin = self.values.get(vid.index as usize).origin.clone();
(vid, origin)
})
.collect()
}