let value = self.resolve_type_vars_if_possible(&value);
// At this point, `value` could in principle refer
- // to types/regions that have been created during
+ // to inference variables that have been created during
// the snapshot. Once we exit `probe()`, those are
// going to be popped, so we will have to
// eliminate any references to them.
fudger.int_vars.is_empty() &&
fudger.float_vars.is_empty() &&
fudger.region_vars.is_empty() {
- return Ok(value);
+ Ok(value)
+ } else {
+ Ok(value.fold_with(&mut fudger))
}
-
- Ok(value.fold_with(&mut fudger))
}
}
self.infcx.next_ty_var(origin)
} else {
// This variable was created before the
- // "fudging". Since we refresh all type
+ // "fudging". Since we refresh all type
// variables to their binding anyhow, we know
// that it is unbound, so we can just return
// it.
use std::u32;
use rustc_data_structures::snapshot_vec as sv;
use rustc_data_structures::unify as ut;
-use ut::UnifyKey;
pub struct TypeVariableTable<'tcx> {
values: sv::SnapshotVec<Delegate>,
self.sub_relations.commit(sub_snapshot);
}
- /// Returns a map from the type variables created during the
- /// snapshot to the origin of the type variable.
+ /// Returns a range of the type variables created during the snapshot.
pub fn vars_since_snapshot(&mut self, s: &Snapshot<'tcx>) -> Range<TyVid> {
- let range = self.values.values_since_snapshot(&s.snapshot);
- TyVid::from_index(range.start as u32)..TyVid::from_index(range.end as u32)
+ let range = self.eq_relations.vars_since_snapshot(&s.eq_snapshot);
+ range.start.vid..range.end.vid
}
/// Finds the set of type variables that existed *before* `s`