@@ -61,21 +61,6 @@ pub struct RegionConstraintCollector<'a, 'tcx> {
6161 undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
6262}
6363
64- impl < ' tcx > std:: ops:: Deref for RegionConstraintCollector < ' _ , ' tcx > {
65- type Target = RegionConstraintStorage < ' tcx > ;
66- #[ inline]
67- fn deref ( & self ) -> & RegionConstraintStorage < ' tcx > {
68- self . storage
69- }
70- }
71-
72- impl < ' tcx > std:: ops:: DerefMut for RegionConstraintCollector < ' _ , ' tcx > {
73- #[ inline]
74- fn deref_mut ( & mut self ) -> & mut RegionConstraintStorage < ' tcx > {
75- self . storage
76- }
77- }
78-
7964pub type VarInfos = IndexVec < RegionVid , RegionVariableInfo > ;
8065
8166/// The full set of region constraints gathered up by the collector.
@@ -324,11 +309,11 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
324309
325310impl < ' tcx > RegionConstraintCollector < ' _ , ' tcx > {
326311 pub fn num_region_vars ( & self ) -> usize {
327- self . var_infos . len ( )
312+ self . storage . var_infos . len ( )
328313 }
329314
330315 pub fn region_constraint_data ( & self ) -> & RegionConstraintData < ' tcx > {
331- & self . data
316+ & self . storage . data
332317 }
333318
334319 /// Takes (and clears) the current set of constraints. Note that
@@ -384,25 +369,25 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
384369 }
385370
386371 pub fn data ( & self ) -> & RegionConstraintData < ' tcx > {
387- & self . data
372+ & self . storage . data
388373 }
389374
390375 pub ( super ) fn start_snapshot ( & mut self ) -> RegionSnapshot {
391376 debug ! ( "RegionConstraintCollector: start_snapshot" ) ;
392- RegionSnapshot { any_unifications : self . any_unifications }
377+ RegionSnapshot { any_unifications : self . storage . any_unifications }
393378 }
394379
395380 pub ( super ) fn rollback_to ( & mut self , snapshot : RegionSnapshot ) {
396381 debug ! ( "RegionConstraintCollector: rollback_to({:?})" , snapshot) ;
397- self . any_unifications = snapshot. any_unifications ;
382+ self . storage . any_unifications = snapshot. any_unifications ;
398383 }
399384
400385 pub ( super ) fn new_region_var (
401386 & mut self ,
402387 universe : ty:: UniverseIndex ,
403388 origin : RegionVariableOrigin ,
404389 ) -> RegionVid {
405- let vid = self . var_infos . push ( RegionVariableInfo { origin, universe } ) ;
390+ let vid = self . storage . var_infos . push ( RegionVariableInfo { origin, universe } ) ;
406391
407392 let u_vid = self . unification_table_mut ( ) . new_key ( RegionVariableValue :: Unknown { universe } ) ;
408393 assert_eq ! ( vid, u_vid. vid) ;
@@ -413,7 +398,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
413398
414399 /// Returns the origin for the given variable.
415400 pub ( super ) fn var_origin ( & self , vid : RegionVid ) -> RegionVariableOrigin {
416- self . var_infos [ vid] . origin
401+ self . storage . var_infos [ vid] . origin
417402 }
418403
419404 fn add_constraint ( & mut self , constraint : Constraint < ' tcx > , origin : SubregionOrigin < ' tcx > ) {
@@ -436,8 +421,8 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
436421 return ;
437422 }
438423
439- let index = self . data . verifys . len ( ) ;
440- self . data . verifys . push ( verify) ;
424+ let index = self . storage . data . verifys . len ( ) ;
425+ self . storage . data . verifys . push ( verify) ;
441426 self . undo_log . push ( AddVerify ( index) ) ;
442427 }
443428
@@ -457,7 +442,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
457442 ( ty:: ReVar ( a) , ty:: ReVar ( b) ) => {
458443 debug ! ( "make_eqregion: unifying {:?} with {:?}" , a, b) ;
459444 if self . unification_table_mut ( ) . unify_var_var ( a, b) . is_ok ( ) {
460- self . any_unifications = true ;
445+ self . storage . any_unifications = true ;
461446 }
462447 }
463448 ( ty:: ReVar ( vid) , _) => {
@@ -467,7 +452,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
467452 . unify_var_value ( vid, RegionVariableValue :: Known { value : b } )
468453 . is_ok ( )
469454 {
470- self . any_unifications = true ;
455+ self . storage . any_unifications = true ;
471456 } ;
472457 }
473458 ( _, ty:: ReVar ( vid) ) => {
@@ -477,7 +462,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
477462 . unify_var_value ( vid, RegionVariableValue :: Known { value : a } )
478463 . is_ok ( )
479464 {
480- self . any_unifications = true ;
465+ self . storage . any_unifications = true ;
481466 } ;
482467 }
483468 ( _, _) => { }
@@ -499,7 +484,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
499484 return ;
500485 }
501486
502- self . data . member_constraints . push ( MemberConstraint {
487+ self . storage . data . member_constraints . push ( MemberConstraint {
503488 key,
504489 definition_span,
505490 hidden_ty,
@@ -615,8 +600,8 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
615600
616601 fn combine_map ( & mut self , t : CombineMapType ) -> & mut CombineMap < ' tcx > {
617602 match t {
618- Glb => & mut self . glbs ,
619- Lub => & mut self . lubs ,
603+ Glb => & mut self . storage . glbs ,
604+ Lub => & mut self . storage . lubs ,
620605 }
621606 }
622607
@@ -669,11 +654,12 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
669654 & self ,
670655 value_count : usize ,
671656 ) -> ( Range < RegionVid > , Vec < RegionVariableOrigin > ) {
672- let range = RegionVid :: from ( value_count) ..RegionVid :: from ( self . unification_table . len ( ) ) ;
657+ let range =
658+ RegionVid :: from ( value_count) ..RegionVid :: from ( self . storage . unification_table . len ( ) ) ;
673659 (
674660 range. clone ( ) ,
675661 ( range. start . index ( ) ..range. end . index ( ) )
676- . map ( |index| self . var_infos [ ty:: RegionVid :: from ( index) ] . origin )
662+ . map ( |index| self . storage . var_infos [ ty:: RegionVid :: from ( index) ] . origin )
677663 . collect ( ) ,
678664 )
679665 }
0 commit comments