diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index ab0ff32dcc3..72b23a3bc18 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -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) } } } diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index a32404c1ac5..34bb9feb5c9 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -67,12 +67,7 @@ pub enum TypeVariableOrigin { Generalized(ty::TyVid), } -pub type TypeVariableMap = FxHashMap; - -pub struct TypeVariableInfo { - pub root_vid: ty::TyVid, - pub root_origin: TypeVariableOrigin, -} +pub type TypeVariableMap = FxHashMap; 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() }