@@ -87,11 +87,7 @@ pub struct TypeVariableStorage<'tcx> {
8787}
8888
8989pub struct TypeVariableTable < ' a , ' tcx > {
90- values : & ' a mut sv:: SnapshotVecStorage < Delegate > ,
91-
92- eq_relations : & ' a mut ut:: UnificationTableStorage < TyVidEqKey < ' tcx > > ,
93-
94- sub_relations : & ' a mut ut:: UnificationTableStorage < ty:: TyVid > ,
90+ storage : & ' a mut TypeVariableStorage < ' tcx > ,
9591
9692 undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
9793}
@@ -165,12 +161,12 @@ impl<'tcx> TypeVariableStorage<'tcx> {
165161 }
166162 }
167163
164+ #[ inline]
168165 pub ( crate ) fn with_log < ' a > (
169166 & ' a mut self ,
170167 undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
171168 ) -> TypeVariableTable < ' a , ' tcx > {
172- let TypeVariableStorage { values, eq_relations, sub_relations } = self ;
173- TypeVariableTable { values, eq_relations, sub_relations, undo_log }
169+ TypeVariableTable { storage : self , undo_log }
174170 }
175171}
176172
@@ -180,15 +176,15 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
180176 /// Note that this function does not return care whether
181177 /// `vid` has been unified with something else or not.
182178 pub fn var_diverges ( & self , vid : ty:: TyVid ) -> bool {
183- self . values . get ( vid. index as usize ) . diverging
179+ self . storage . values . get ( vid. index as usize ) . diverging
184180 }
185181
186182 /// Returns the origin that was given when `vid` was created.
187183 ///
188184 /// Note that this function does not return care whether
189185 /// `vid` has been unified with something else or not.
190186 pub fn var_origin ( & self , vid : ty:: TyVid ) -> & TypeVariableOrigin {
191- & self . values . get ( vid. index as usize ) . origin
187+ & self . storage . values . get ( vid. index as usize ) . origin
192188 }
193189
194190 /// Records that `a == b`, depending on `dir`.
@@ -265,7 +261,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
265261
266262 /// Returns the number of type variables created thus far.
267263 pub fn num_vars ( & self ) -> usize {
268- self . values . len ( )
264+ self . storage . values . len ( )
269265 }
270266
271267 /// Returns the "root" variable of `vid` in the `eq_relations`
@@ -319,18 +315,21 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
319315 }
320316 }
321317
318+ #[ inline]
322319 fn values (
323320 & mut self ,
324321 ) -> sv:: SnapshotVec < Delegate , & mut Vec < TypeVariableData > , & mut InferCtxtUndoLogs < ' tcx > > {
325- self . values . with_log ( self . undo_log )
322+ self . storage . values . with_log ( self . undo_log )
326323 }
327324
325+ #[ inline]
328326 fn eq_relations ( & mut self ) -> super :: UnificationTable < ' _ , ' tcx , TyVidEqKey < ' tcx > > {
329- self . eq_relations . with_log ( self . undo_log )
327+ self . storage . eq_relations . with_log ( self . undo_log )
330328 }
331329
330+ #[ inline]
332331 fn sub_relations ( & mut self ) -> super :: UnificationTable < ' _ , ' tcx , ty:: TyVid > {
333- self . sub_relations . with_log ( self . undo_log )
332+ self . storage . sub_relations . with_log ( self . undo_log )
334333 }
335334
336335 /// Returns a range of the type variables created during the snapshot.
@@ -342,7 +341,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
342341 (
343342 range. start ..range. end ,
344343 ( range. start . index ..range. end . index )
345- . map ( |index| self . values . get ( index as usize ) . origin )
344+ . map ( |index| self . storage . values . get ( index as usize ) . origin )
346345 . collect ( ) ,
347346 )
348347 }
@@ -378,7 +377,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
378377 // quick check to see if this variable was
379378 // created since the snapshot started or not.
380379 let mut eq_relations = ut:: UnificationTable :: with_log (
381- & mut * self . eq_relations ,
380+ & mut self . storage . eq_relations ,
382381 & mut * self . undo_log ,
383382 ) ;
384383 let escaping_type = match eq_relations. probe_value ( vid) {
@@ -400,7 +399,7 @@ impl<'tcx> TypeVariableTable<'_, 'tcx> {
400399 /// Returns indices of all variables that are not yet
401400 /// instantiated.
402401 pub fn unsolved_variables ( & mut self ) -> Vec < ty:: TyVid > {
403- ( 0 ..self . values . len ( ) )
402+ ( 0 ..self . storage . values . len ( ) )
404403 . filter_map ( |i| {
405404 let vid = ty:: TyVid { index : i as u32 } ;
406405 match self . probe ( vid) {
0 commit comments