about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-03-21 17:11:42 +0000
committervarkor <github@varkor.com>2019-03-27 09:44:55 +0000
commit267370ed585a722a551e3b493e4a32dc6ebe80ce (patch)
tree7d69a59d7ef2332e3cff13ee1ac65dd19acec31d
parentfa18c129c3cbb1ef9f731da126a3b2fdcfbd03a6 (diff)
downloadrust-267370ed585a722a551e3b493e4a32dc6ebe80ce.tar.gz
rust-267370ed585a722a551e3b493e4a32dc6ebe80ce.zip
Use `eq_relations`
-rw-r--r--src/librustc/infer/fudge.rs10
-rw-r--r--src/librustc/infer/type_variable.rs8
2 files changed, 8 insertions, 10 deletions
diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs
index ba9100bc4f7..18573b9ce17 100644
--- a/src/librustc/infer/fudge.rs
+++ b/src/librustc/infer/fudge.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.
diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs
index a09c03c34ca..5b9c3f25b20 100644
--- a/src/librustc/infer/type_variable.rs
+++ b/src/librustc/infer/type_variable.rs
@@ -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`