@@ -61,21 +61,6 @@ pub struct RegionConstraintCollector<'a, 'tcx> {
61
61
undo_log : & ' a mut InferCtxtUndoLogs < ' tcx > ,
62
62
}
63
63
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
-
79
64
pub type VarInfos = IndexVec < RegionVid , RegionVariableInfo > ;
80
65
81
66
/// The full set of region constraints gathered up by the collector.
@@ -324,11 +309,11 @@ impl<'tcx> RegionConstraintStorage<'tcx> {
324
309
325
310
impl < ' tcx > RegionConstraintCollector < ' _ , ' tcx > {
326
311
pub fn num_region_vars ( & self ) -> usize {
327
- self . var_infos . len ( )
312
+ self . storage . var_infos . len ( )
328
313
}
329
314
330
315
pub fn region_constraint_data ( & self ) -> & RegionConstraintData < ' tcx > {
331
- & self . data
316
+ & self . storage . data
332
317
}
333
318
334
319
/// Takes (and clears) the current set of constraints. Note that
@@ -384,25 +369,25 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
384
369
}
385
370
386
371
pub fn data ( & self ) -> & RegionConstraintData < ' tcx > {
387
- & self . data
372
+ & self . storage . data
388
373
}
389
374
390
375
pub ( super ) fn start_snapshot ( & mut self ) -> RegionSnapshot {
391
376
debug ! ( "RegionConstraintCollector: start_snapshot" ) ;
392
- RegionSnapshot { any_unifications : self . any_unifications }
377
+ RegionSnapshot { any_unifications : self . storage . any_unifications }
393
378
}
394
379
395
380
pub ( super ) fn rollback_to ( & mut self , snapshot : RegionSnapshot ) {
396
381
debug ! ( "RegionConstraintCollector: rollback_to({:?})" , snapshot) ;
397
- self . any_unifications = snapshot. any_unifications ;
382
+ self . storage . any_unifications = snapshot. any_unifications ;
398
383
}
399
384
400
385
pub ( super ) fn new_region_var (
401
386
& mut self ,
402
387
universe : ty:: UniverseIndex ,
403
388
origin : RegionVariableOrigin ,
404
389
) -> RegionVid {
405
- let vid = self . var_infos . push ( RegionVariableInfo { origin, universe } ) ;
390
+ let vid = self . storage . var_infos . push ( RegionVariableInfo { origin, universe } ) ;
406
391
407
392
let u_vid = self . unification_table_mut ( ) . new_key ( RegionVariableValue :: Unknown { universe } ) ;
408
393
assert_eq ! ( vid, u_vid. vid) ;
@@ -413,7 +398,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
413
398
414
399
/// Returns the origin for the given variable.
415
400
pub ( super ) fn var_origin ( & self , vid : RegionVid ) -> RegionVariableOrigin {
416
- self . var_infos [ vid] . origin
401
+ self . storage . var_infos [ vid] . origin
417
402
}
418
403
419
404
fn add_constraint ( & mut self , constraint : Constraint < ' tcx > , origin : SubregionOrigin < ' tcx > ) {
@@ -436,8 +421,8 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
436
421
return ;
437
422
}
438
423
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) ;
441
426
self . undo_log . push ( AddVerify ( index) ) ;
442
427
}
443
428
@@ -457,7 +442,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
457
442
( ty:: ReVar ( a) , ty:: ReVar ( b) ) => {
458
443
debug ! ( "make_eqregion: unifying {:?} with {:?}" , a, b) ;
459
444
if self . unification_table_mut ( ) . unify_var_var ( a, b) . is_ok ( ) {
460
- self . any_unifications = true ;
445
+ self . storage . any_unifications = true ;
461
446
}
462
447
}
463
448
( ty:: ReVar ( vid) , _) => {
@@ -467,7 +452,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
467
452
. unify_var_value ( vid, RegionVariableValue :: Known { value : b } )
468
453
. is_ok ( )
469
454
{
470
- self . any_unifications = true ;
455
+ self . storage . any_unifications = true ;
471
456
} ;
472
457
}
473
458
( _, ty:: ReVar ( vid) ) => {
@@ -477,7 +462,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
477
462
. unify_var_value ( vid, RegionVariableValue :: Known { value : a } )
478
463
. is_ok ( )
479
464
{
480
- self . any_unifications = true ;
465
+ self . storage . any_unifications = true ;
481
466
} ;
482
467
}
483
468
( _, _) => { }
@@ -499,7 +484,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
499
484
return ;
500
485
}
501
486
502
- self . data . member_constraints . push ( MemberConstraint {
487
+ self . storage . data . member_constraints . push ( MemberConstraint {
503
488
key,
504
489
definition_span,
505
490
hidden_ty,
@@ -615,8 +600,8 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
615
600
616
601
fn combine_map ( & mut self , t : CombineMapType ) -> & mut CombineMap < ' tcx > {
617
602
match t {
618
- Glb => & mut self . glbs ,
619
- Lub => & mut self . lubs ,
603
+ Glb => & mut self . storage . glbs ,
604
+ Lub => & mut self . storage . lubs ,
620
605
}
621
606
}
622
607
@@ -669,11 +654,12 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
669
654
& self ,
670
655
value_count : usize ,
671
656
) -> ( 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 ( ) ) ;
673
659
(
674
660
range. clone ( ) ,
675
661
( 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 )
677
663
. collect ( ) ,
678
664
)
679
665
}
0 commit comments