]> git.lizzy.rs Git - rust.git/commitdiff
Use `eq_relations`
authorvarkor <github@varkor.com>
Thu, 21 Mar 2019 17:11:42 +0000 (17:11 +0000)
committervarkor <github@varkor.com>
Wed, 27 Mar 2019 09:44:55 +0000 (09:44 +0000)
src/librustc/infer/fudge.rs
src/librustc/infer/type_variable.rs

index ba9100bc4f7a77e10d83ac5fb27408b4d49fcfca..18573b9ce176faad1b6d38be0bfa0f917da80a06 100644 (file)
@@ -62,7 +62,7 @@ pub fn fudge_inference_if_ok<T, E, F>(
                     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 @@ pub fn fudge_inference_if_ok<T, E, F>(
             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 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'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.
index a09c03c34cafafdb24be86af8cec2b0a9323c95e..5b9c3f25b20fd6b79fe6e4c68d47c67150a92835 100644 (file)
@@ -8,7 +8,6 @@
 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 @@ pub fn commit(&mut self, s: Snapshot<'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`