]> git.lizzy.rs Git - rust.git/commitdiff
Simplify `TypeVariableTable::vars_since_snapshot`
authorvarkor <github@varkor.com>
Wed, 20 Mar 2019 10:07:30 +0000 (10:07 +0000)
committervarkor <github@varkor.com>
Wed, 27 Mar 2019 09:44:55 +0000 (09:44 +0000)
src/librustc/infer/type_variable.rs

index ae7ac855228dda519e2c279b6efe8d2bd7facca2..422dd24eb0b45e13db6c1f87e9b379292eb6eaa6 100644 (file)
@@ -295,19 +295,10 @@ pub fn commit(&mut self, s: Snapshot<'tcx>) {
     /// Returns a map from the type variables created during the
     /// snapshot to the origin of the type variable.
     pub fn vars_since_snapshot(&mut self, s: &Snapshot<'tcx>) -> TypeVariableMap {
-        let actions_since_snapshot = self.values.actions_since_snapshot(&s.snapshot);
-
-        actions_since_snapshot
-            .iter()
-            .filter_map(|action| match action {
-                &sv::UndoLog::NewElem(index) => Some(ty::TyVid { index: index as u32 }),
-                _ => None,
-            })
-            .map(|vid| {
-                let origin = self.values.get(vid.index as usize).origin.clone();
-                (vid, origin)
-            })
-            .collect()
+        self.values.values_since_snapshot(&s.snapshot).map(|idx| {
+            let origin = self.values.get(idx).origin.clone();
+            (ty::TyVid { index: idx as u32 }, origin)
+        }).collect()
     }
 
     /// Finds the set of type variables that existed *before* `s`