Skip to content
Permalink
Browse files

Use `eq_relations`

  • Loading branch information...
varkor committed Mar 21, 2019
1 parent fa18c12 commit 267370ed585a722a551e3b493e4a32dc6ebe80ce
Showing with 8 additions and 10 deletions.
  1. +5 −5 src/librustc/infer/fudge.rs
  2. +3 −5 src/librustc/infer/type_variable.rs
@@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
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.
@@ -106,10 +106,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
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))
}
}

@@ -137,7 +137,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx>
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.
@@ -8,7 +8,6 @@ use std::ops::Range;
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>,
@@ -291,11 +290,10 @@ impl<'tcx> TypeVariableTable<'tcx> {
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`

0 comments on commit 267370e

Please sign in to comment.
You can’t perform that action at this time.