@@ -5,6 +5,7 @@ use rustc_infer::infer::canonical::QueryRegionConstraints;
5
5
use rustc_infer:: infer:: outlives:: for_liveness;
6
6
use rustc_middle:: mir:: { BasicBlock , Body , ConstraintCategory , Local , Location } ;
7
7
use rustc_middle:: traits:: query:: DropckOutlivesResult ;
8
+ use rustc_middle:: ty:: relate:: Relate ;
8
9
use rustc_middle:: ty:: { Ty , TyCtxt , TypeVisitable , TypeVisitableExt } ;
9
10
use rustc_mir_dataflow:: ResultsCursor ;
10
11
use rustc_mir_dataflow:: impls:: MaybeInitializedPlaces ;
@@ -532,11 +533,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
532
533
533
534
/// Stores the result that all regions in `value` are live for the
534
535
/// points `live_at`.
535
- fn add_use_live_facts_for (
536
- & mut self ,
537
- value : impl TypeVisitable < TyCtxt < ' tcx > > ,
538
- live_at : & IntervalSet < PointIndex > ,
539
- ) {
536
+ fn add_use_live_facts_for ( & mut self , value : Ty < ' tcx > , live_at : & IntervalSet < PointIndex > ) {
540
537
debug ! ( "add_use_live_facts_for(value={:?})" , value) ;
541
538
Self :: make_all_regions_live ( self . elements , self . typeck , value, live_at) ;
542
539
}
@@ -603,7 +600,7 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
603
600
fn make_all_regions_live (
604
601
elements : & DenseLocationMap ,
605
602
typeck : & mut TypeChecker < ' _ , ' tcx > ,
606
- value : impl TypeVisitable < TyCtxt < ' tcx > > ,
603
+ value : impl TypeVisitable < TyCtxt < ' tcx > > + Relate < TyCtxt < ' tcx > > ,
607
604
live_at : & IntervalSet < PointIndex > ,
608
605
) {
609
606
debug ! ( "make_all_regions_live(value={:?})" , value) ;
@@ -621,6 +618,15 @@ impl<'tcx> LivenessContext<'_, '_, '_, 'tcx> {
621
618
typeck. constraints . liveness_constraints . add_points ( live_region_vid, live_at) ;
622
619
} ,
623
620
} ) ;
621
+
622
+ // When using `-Zpolonius=next`, we record the variance of each live region.
623
+ if let Some ( polonius_context) = typeck. polonius_context {
624
+ polonius_context. record_live_region_variance (
625
+ typeck. infcx . tcx ,
626
+ typeck. universal_regions ,
627
+ value,
628
+ ) ;
629
+ }
624
630
}
625
631
626
632
fn compute_drop_data ( typeck : & TypeChecker < ' _ , ' tcx > , dropped_ty : Ty < ' tcx > ) -> DropData < ' tcx > {
0 commit comments