diff options
| author | varkor <github@varkor.com> | 2019-03-20 10:07:30 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-03-27 09:44:55 +0000 |
| commit | a5c653be6389c5d62368ed07c60f064b6f1c037e (patch) | |
| tree | cd60daa7cc407e41d38060a64982ec7a0f3432a7 | |
| parent | 2a08860ae6ec94eccbe7b2b73fbe9d0c175196d4 (diff) | |
| download | rust-a5c653be6389c5d62368ed07c60f064b6f1c037e.tar.gz rust-a5c653be6389c5d62368ed07c60f064b6f1c037e.zip | |
Simplify `TypeVariableTable::vars_since_snapshot`
| -rw-r--r-- | src/librustc/infer/type_variable.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index ae7ac855228..422dd24eb0b 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -295,19 +295,10 @@ impl<'tcx> TypeVariableTable<'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` |
