dependencies = [
"cargo_metadata 0.9.1",
"if_chain",
- "itertools 0.8.0",
+ "itertools 0.9.0",
"lazy_static 1.4.0",
"pulldown-cmark 0.7.1",
"quine-mc_cluskey",
"either",
]
+[[package]]
+name = "itertools"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "0.4.4"
"rustc-workspace-hack",
"rustc_version",
"serde",
+ "serde_json",
"shell-escape",
"vergen",
]
/// that might instantiate a general type variable have an order,
/// represented by its upper and lower bounds.
type_variables: type_variable::TypeVariableStorage<'tcx>,
- undo_log: Logs<'tcx>,
/// Map from const parameter variable to the kind of const it represents.
const_unification_table: ut::UnificationStorage<ty::ConstVid<'tcx>>,
/// obligations within. This is expected to be done 'late enough'
/// that all type inference variables have been bound and so forth.
region_obligations: Vec<(hir::HirId, RegionObligation<'tcx>)>,
+
+ undo_log: InferCtxtUndoLogs<'tcx>,
}
impl<'tcx> InferCtxtInner<'tcx> {
InferCtxtInner {
projection_cache: Default::default(),
type_variables: type_variable::TypeVariableStorage::new(),
- undo_log: Logs::default(),
+ undo_log: InferCtxtUndoLogs::default(),
const_unification_table: ut::UnificationStorage::new(),
int_unification_table: ut::UnificationStorage::new(),
float_unification_table: ut::UnificationStorage::new(),
fn int_unification_table(
&mut self,
) -> ut::UnificationTable<
- ut::InPlace<ty::IntVid, &mut ut::UnificationStorage<ty::IntVid>, &mut Logs<'tcx>>,
+ ut::InPlace<
+ ty::IntVid,
+ &mut ut::UnificationStorage<ty::IntVid>,
+ &mut InferCtxtUndoLogs<'tcx>,
+ >,
> {
ut::UnificationTable::with_log(&mut self.int_unification_table, &mut self.undo_log)
}
fn float_unification_table(
&mut self,
) -> ut::UnificationTable<
- ut::InPlace<ty::FloatVid, &mut ut::UnificationStorage<ty::FloatVid>, &mut Logs<'tcx>>,
+ ut::InPlace<
+ ty::FloatVid,
+ &mut ut::UnificationStorage<ty::FloatVid>,
+ &mut InferCtxtUndoLogs<'tcx>,
+ >,
> {
ut::UnificationTable::with_log(&mut self.float_unification_table, &mut self.undo_log)
}
ut::InPlace<
ty::ConstVid<'tcx>,
&mut ut::UnificationStorage<ty::ConstVid<'tcx>>,
- &mut Logs<'tcx>,
+ &mut InferCtxtUndoLogs<'tcx>,
>,
> {
ut::UnificationTable::with_log(&mut self.const_unification_table, &mut self.undo_log)
}
}
-pub(crate) type UnificationTable<'a, 'tcx, T> =
- ut::UnificationTable<ut::InPlace<T, &'a mut ut::UnificationStorage<T>, &'a mut Logs<'tcx>>>;
+pub(crate) type UnificationTable<'a, 'tcx, T> = ut::UnificationTable<
+ ut::InPlace<T, &'a mut ut::UnificationStorage<T>, &'a mut InferCtxtUndoLogs<'tcx>>,
+>;
struct RollbackView<'tcx, 'a> {
type_variables: &'a mut type_variable::TypeVariableStorage<'tcx>,
}
}
-pub(crate) struct Logs<'tcx> {
+pub(crate) struct InferCtxtUndoLogs<'tcx> {
logs: Vec<UndoLog<'tcx>>,
num_open_snapshots: usize,
}
-impl Default for Logs<'_> {
+impl Default for InferCtxtUndoLogs<'_> {
fn default() -> Self {
Self { logs: Default::default(), num_open_snapshots: Default::default() }
}
}
-impl<'tcx, T> UndoLogs<T> for Logs<'tcx>
+impl<'tcx, T> UndoLogs<T> for InferCtxtUndoLogs<'tcx>
where
UndoLog<'tcx>: From<T>,
{
}
}
-impl<'tcx> Snapshots<UndoLog<'tcx>> for Logs<'tcx> {
+impl<'tcx> Snapshots<UndoLog<'tcx>> for InferCtxtUndoLogs<'tcx> {
type Snapshot = Snapshot<'tcx>;
fn actions_since_snapshot(&self, snapshot: &Self::Snapshot) -> &[UndoLog<'tcx>] {
&self.logs[snapshot.undo_len..]
}
}
-impl<'tcx> Logs<'tcx> {
+impl<'tcx> InferCtxtUndoLogs<'tcx> {
pub(crate) fn region_constraints(
&self,
after: usize,
use self::UndoLog::*;
use super::unify_key;
-use super::{Logs, MiscVariable, RegionVariableOrigin, Rollback, Snapshot, SubregionOrigin};
+use super::{
+ InferCtxtUndoLogs, MiscVariable, RegionVariableOrigin, Rollback, Snapshot, SubregionOrigin,
+};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sync::Lrc;
pub struct RegionConstraintCollector<'tcx, 'a> {
storage: &'a mut RegionConstraintStorage<'tcx>,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
}
impl std::ops::Deref for RegionConstraintCollector<'tcx, '_> {
pub(crate) fn with_log<'a>(
&'a mut self,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
) -> RegionConstraintCollector<'tcx, 'a> {
RegionConstraintCollector { storage: self, undo_log }
}
use rustc_span::symbol::Symbol;
use rustc_span::Span;
-use crate::infer::Logs;
+use crate::infer::InferCtxtUndoLogs;
use rustc_data_structures::snapshot_vec as sv;
use rustc_data_structures::unify as ut;
sub_relations: &'a mut ut::UnificationStorage<ty::TyVid>,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
}
#[derive(Copy, Clone, Debug)]
pub(crate) fn with_log<'a>(
&'a mut self,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
) -> TypeVariableTable<'tcx, 'a> {
let TypeVariableStorage { values, eq_relations, sub_relations } = self;
TypeVariableTable { values, eq_relations, sub_relations, undo_log }
Snapshot { value_count: self.eq_relations().len() as u32, _marker: PhantomData }
}
- fn values(&mut self) -> sv::SnapshotVec<Delegate, &mut Vec<TypeVariableData>, &mut Logs<'tcx>> {
+ fn values(
+ &mut self,
+ ) -> sv::SnapshotVec<Delegate, &mut Vec<TypeVariableData>, &mut InferCtxtUndoLogs<'tcx>> {
sv::SnapshotVec::with_log(self.values, self.undo_log)
}
use super::PredicateObligation;
-use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap};
+use rustc_data_structures::snapshot_map::{self, SnapshotMapRef, SnapshotMapStorage};
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::{self, Ty};
// reduce the amount of duplication. Let's see what we get with the Chalk reforms.
pub struct ProjectionCache<'tcx, 'a> {
map: &'a mut SnapshotMapStorage<ProjectionCacheKey<'tcx>, ProjectionCacheEntry<'tcx>>,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
}
#[derive(Default)]
impl<'tcx> ProjectionCacheStorage<'tcx> {
pub(crate) fn with_log<'a>(
&'a mut self,
- undo_log: &'a mut Logs<'tcx>,
+ undo_log: &'a mut InferCtxtUndoLogs<'tcx>,
) -> ProjectionCache<'tcx, 'a> {
ProjectionCache { map: &mut self.map, undo_log }
}
impl<'tcx> ProjectionCache<'tcx, '_> {
fn map(
&mut self,
- ) -> SnapshotMapRef<'_, ProjectionCacheKey<'tcx>, ProjectionCacheEntry<'tcx>, Logs<'tcx>> {
+ ) -> SnapshotMapRef<
+ '_,
+ ProjectionCacheKey<'tcx>,
+ ProjectionCacheEntry<'tcx>,
+ InferCtxtUndoLogs<'tcx>,
+ > {
self.map.with_log(self.undo_log)
}