diff options
| author | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-03-03 10:23:04 +0100 |
|---|---|---|
| committer | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-05-05 11:25:12 +0200 |
| commit | fba241fc6690527a3aad4bee98aca00a7c0907ad (patch) | |
| tree | 743417f7a3ad4d82e5dfa246dd52cb043d803b73 /src | |
| parent | 729d16f0104887a0b37b8e5bb9f0f495e4efdd10 (diff) | |
| download | rust-fba241fc6690527a3aad4bee98aca00a7c0907ad.tar.gz rust-fba241fc6690527a3aad4bee98aca00a7c0907ad.zip | |
refactor: simplify
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_infer/infer/fudge.rs | 10 | ||||
| -rw-r--r-- | src/librustc_infer/infer/mod.rs | 19 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/librustc_infer/infer/fudge.rs b/src/librustc_infer/infer/fudge.rs index a105a7704fa..ccc4a73d40f 100644 --- a/src/librustc_infer/infer/fudge.rs +++ b/src/librustc_infer/infer/fudge.rs @@ -24,9 +24,9 @@ where fn const_vars_since_snapshot<'tcx>( table: &mut UnificationTable<'_, 'tcx, ConstVid<'tcx>>, - snapshot: usize, + snapshot_var_len: usize, ) -> (Range<ConstVid<'tcx>>, Vec<ConstVariableOrigin>) { - let range = vars_since_snapshot(table, snapshot); + let range = vars_since_snapshot(table, snapshot_var_len); ( range.start..range.end, (range.start.index..range.end.index) @@ -98,18 +98,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { inner.type_variables().vars_since_snapshot(&snapshot.type_snapshot); let int_vars = vars_since_snapshot( &mut inner.int_unification_table(), - snapshot.int_snapshot, + snapshot.int_var_len, ); let float_vars = vars_since_snapshot( &mut inner.float_unification_table(), - snapshot.float_snapshot, + snapshot.float_var_len, ); let region_vars = inner .unwrap_region_constraints() .vars_since_snapshot(&snapshot.region_constraints_snapshot); let const_vars = const_vars_since_snapshot( &mut inner.const_unification_table(), - snapshot.const_snapshot, + snapshot.const_var_len, ); let fudger = InferenceFudger { diff --git a/src/librustc_infer/infer/mod.rs b/src/librustc_infer/infer/mod.rs index 93b6a0220bf..1210d561311 100644 --- a/src/librustc_infer/infer/mod.rs +++ b/src/librustc_infer/infer/mod.rs @@ -39,7 +39,6 @@ use rustc_span::Span; use std::cell::{Cell, Ref, RefCell}; use std::collections::BTreeMap; use std::fmt; -use std::marker::PhantomData; use self::combine::CombineFields; use self::free_regions::RegionRelations; @@ -241,7 +240,7 @@ impl<'tcx> InferCtxtInner<'tcx> { &mut InferCtxtUndoLogs<'tcx>, >, > { - ut::UnificationTable::with_log(&mut self.int_unification_table, &mut self.undo_log) + self.int_unification_table.with_log(&mut self.undo_log) } fn float_unification_table( @@ -253,7 +252,7 @@ impl<'tcx> InferCtxtInner<'tcx> { &mut InferCtxtUndoLogs<'tcx>, >, > { - ut::UnificationTable::with_log(&mut self.float_unification_table, &mut self.undo_log) + self.float_unification_table.with_log(&mut self.undo_log) } fn const_unification_table( @@ -265,7 +264,7 @@ impl<'tcx> InferCtxtInner<'tcx> { &mut InferCtxtUndoLogs<'tcx>, >, > { - ut::UnificationTable::with_log(&mut self.const_unification_table, &mut self.undo_log) + self.const_unification_table.with_log(&mut self.undo_log) } pub fn unwrap_region_constraints(&mut self) -> RegionConstraintCollector<'tcx, '_> { @@ -711,9 +710,9 @@ pub struct FullSnapshot<'a, 'tcx> { snapshot: CombinedSnapshot<'a, 'tcx>, region_constraints_snapshot: RegionSnapshot, type_snapshot: type_variable::Snapshot<'tcx>, - const_snapshot: usize, - int_snapshot: usize, - float_snapshot: usize, + const_var_len: usize, + int_var_len: usize, + float_var_len: usize, } #[must_use = "once you start a snapshot, you should always consume it"] @@ -837,9 +836,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { FullSnapshot { snapshot, type_snapshot: inner.type_variables().snapshot(), - const_snapshot: inner.const_unification_table().len(), - int_snapshot: inner.int_unification_table().len(), - float_snapshot: inner.float_unification_table().len(), + const_var_len: inner.const_unification_table().len(), + int_var_len: inner.int_unification_table().len(), + float_var_len: inner.float_unification_table().len(), region_constraints_snapshot: inner.unwrap_region_constraints().start_snapshot(), } } |
