@@ -54,12 +54,12 @@ impl<'tcx> Rollback<UndoLog<'tcx>> for TypeVariableStorage<'tcx> {
54
54
}
55
55
56
56
pub struct TypeVariableStorage < ' tcx > {
57
- values : Vec < TypeVariableData > ,
57
+ values : sv :: SnapshotVecStorage < Delegate > ,
58
58
59
59
/// Two variables are unified in `eq_relations` when we have a
60
60
/// constraint `?X == ?Y`. This table also stores, for each key,
61
61
/// the known value.
62
- eq_relations : ut:: UnificationStorage < TyVidEqKey < ' tcx > > ,
62
+ eq_relations : ut:: UnificationTableStorage < TyVidEqKey < ' tcx > > ,
63
63
64
64
/// Two variables are unified in `sub_relations` when we have a
65
65
/// constraint `?X <: ?Y` *or* a constraint `?Y <: ?X`. This second
@@ -78,15 +78,15 @@ pub struct TypeVariableStorage<'tcx> {
78
78
/// This is reasonable because, in Rust, subtypes have the same
79
79
/// "skeleton" and hence there is no possible type such that
80
80
/// (e.g.) `Box<?3> <: ?3` for any `?3`.
81
- sub_relations : ut:: UnificationStorage < ty:: TyVid > ,
81
+ sub_relations : ut:: UnificationTableStorage < ty:: TyVid > ,
82
82
}
83
83
84
84
pub struct TypeVariableTable < ' tcx , ' a > {
85
- values : & ' a mut Vec < TypeVariableData > ,
85
+ values : & ' a mut sv :: SnapshotVecStorage < Delegate > ,
86
86
87
- eq_relations : & ' a mut ut:: UnificationStorage < TyVidEqKey < ' tcx > > ,
87
+ eq_relations : & ' a mut ut:: UnificationTableStorage < TyVidEqKey < ' tcx > > ,
88
88
89
- sub_relations : & ' a mut ut:: UnificationStorage < ty:: TyVid > ,
89
+ sub_relations : & ' a mut ut:: UnificationTableStorage < ty:: TyVid > ,
90
90
91
91
undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
92
92
}
@@ -159,9 +159,9 @@ pub(crate) struct Delegate;
159
159
impl < ' tcx > TypeVariableStorage < ' tcx > {
160
160
pub fn new ( ) -> TypeVariableStorage < ' tcx > {
161
161
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 ( ) ,
165
165
}
166
166
}
167
167
@@ -180,15 +180,15 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
180
180
/// Note that this function does not return care whether
181
181
/// `vid` has been unified with something else or not.
182
182
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
184
184
}
185
185
186
186
/// Returns the origin that was given when `vid` was created.
187
187
///
188
188
/// Note that this function does not return care whether
189
189
/// `vid` has been unified with something else or not.
190
190
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
192
192
}
193
193
194
194
/// Records that `a == b`, depending on `dir`.
@@ -330,15 +330,15 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
330
330
fn values (
331
331
& mut self ,
332
332
) -> 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 )
334
334
}
335
335
336
336
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 )
338
338
}
339
339
340
340
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 )
342
342
}
343
343
344
344
/// Returns a range of the type variables created during the snapshot.
@@ -351,7 +351,7 @@ impl<'tcx> TypeVariableTable<'tcx, '_> {
351
351
(
352
352
range. start ..range. end ,
353
353
( 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 )
355
355
. collect ( ) ,
356
356
)
357
357
}
0 commit comments