@@ -54,12 +54,12 @@ impl<'tcx> Rollback<UndoLog<'tcx>> for TypeVariableStorage<'tcx> {
5454}
5555
5656pub struct TypeVariableStorage < ' tcx > {
57- values : Vec < TypeVariableData > ,
57+ values : sv :: SnapshotVecStorage < Delegate > ,
5858
5959 /// Two variables are unified in `eq_relations` when we have a
6060 /// constraint `?X == ?Y`. This table also stores, for each key,
6161 /// the known value.
62- eq_relations : ut:: UnificationStorage < TyVidEqKey < ' tcx > > ,
62+ eq_relations : ut:: UnificationTableStorage < TyVidEqKey < ' tcx > > ,
6363
6464 /// Two variables are unified in `sub_relations` when we have a
6565 /// constraint `?X <: ?Y` *or* a constraint `?Y <: ?X`. This second
@@ -78,15 +78,15 @@ pub struct TypeVariableStorage<'tcx> {
7878 /// This is reasonable because, in Rust, subtypes have the same
7979 /// "skeleton" and hence there is no possible type such that
8080 /// (e.g.) `Box<?3> <: ?3` for any `?3`.
81- sub_relations : ut:: UnificationStorage < ty:: TyVid > ,
81+ sub_relations : ut:: UnificationTableStorage < ty:: TyVid > ,
8282}
8383
8484pub struct TypeVariableTable < ' tcx , ' a > {
85- values : & ' a mut Vec < TypeVariableData > ,
85+ values : & ' a mut sv :: SnapshotVecStorage < Delegate > ,
8686
87- eq_relations : & ' a mut ut:: UnificationStorage < TyVidEqKey < ' tcx > > ,
87+ eq_relations : & ' a mut ut:: UnificationTableStorage < TyVidEqKey < ' tcx > > ,
8888
89- sub_relations : & ' a mut ut:: UnificationStorage < ty:: TyVid > ,
89+ sub_relations : & ' a mut ut:: UnificationTableStorage < ty:: TyVid > ,
9090
9191 undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
9292}
@@ -159,9 +159,9 @@ pub(crate) struct Delegate;
159159impl < ' tcx > TypeVariableStorage < ' tcx > {
160160 pub fn new ( ) -> TypeVariableStorage < ' tcx > {
161161 TypeVariableStorage {
162- values : Vec :: new ( ) ,
163- eq_relations : ut:: UnificationStorage :: new ( ) ,
164- sub_relations : ut:: UnificationStorage :: new ( ) ,
162+ values : sv :: SnapshotVecStorage :: new ( ) ,
163+ eq_relations : ut:: UnificationTableStorage :: new ( ) ,
164+ sub_relations : ut:: UnificationTableStorage :: new ( ) ,
165165 }
166166 }
167167
@@ -180,15 +180,15 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
180180 /// Note that this function does not return care whether
181181 /// `vid` has been unified with something else or not.
182182 pub fn var_diverges ( & self , vid : ty:: TyVid ) -> bool {
183- self . values . get ( vid. index as usize ) . unwrap ( ) . diverging
183+ self . values . get ( vid. index as usize ) . diverging
184184 }
185185
186186 /// Returns the origin that was given when `vid` was created.
187187 ///
188188 /// Note that this function does not return care whether
189189 /// `vid` has been unified with something else or not.
190190 pub fn var_origin ( & self , vid : ty:: TyVid ) -> & TypeVariableOrigin {
191- & self . values . get ( vid. index as usize ) . unwrap ( ) . origin
191+ & self . values . get ( vid. index as usize ) . origin
192192 }
193193
194194 /// Records that `a == b`, depending on `dir`.
@@ -330,15 +330,15 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
330330 fn values (
331331 & mut self ,
332332 ) -> sv:: SnapshotVec < Delegate , & mut Vec < TypeVariableData > , & mut InferCtxtUndoLogs < ' tcx > > {
333- sv :: SnapshotVec :: with_log ( self . values , self . undo_log )
333+ self . values . with_log ( self . undo_log )
334334 }
335335
336336 fn eq_relations ( & mut self ) -> super :: UnificationTable < ' _ , ' tcx , TyVidEqKey < ' tcx > > {
337- ut :: UnificationTable :: with_log ( self . eq_relations , self . undo_log )
337+ self . eq_relations . with_log ( self . undo_log )
338338 }
339339
340340 fn sub_relations ( & mut self ) -> super :: UnificationTable < ' _ , ' tcx , ty:: TyVid > {
341- ut :: UnificationTable :: with_log ( self . sub_relations , self . undo_log )
341+ self . sub_relations . with_log ( self . undo_log )
342342 }
343343
344344 /// Returns a range of the type variables created during the snapshot.
@@ -351,7 +351,7 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
351351 (
352352 range. start ..range. end ,
353353 ( range. start . index ..range. end . index )
354- . map ( |index| self . values . get ( index as usize ) . unwrap ( ) . origin )
354+ . map ( |index| self . values . get ( index as usize ) . origin )
355355 . collect ( ) ,
356356 )
357357 }
0 commit comments