@@ -14,7 +14,7 @@ use tracing::{debug, instrument, trace};
1414use crate :: constraints:: { ConstraintSccIndex , OutlivesConstraintSet } ;
1515use crate :: consumers:: OutlivesConstraint ;
1616use crate :: diagnostics:: { RegionErrorKind , RegionErrors , UniverseInfo } ;
17- use crate :: region_infer:: values:: { LivenessValues , PlaceholderIndices } ;
17+ use crate :: region_infer:: values:: LivenessValues ;
1818use crate :: region_infer:: { ConstraintSccs , RegionDefinition , Representative , TypeTest } ;
1919use crate :: ty:: VarianceDiagInfo ;
2020use crate :: type_check:: free_region_relations:: UniversalRegionRelations ;
@@ -32,7 +32,6 @@ pub(crate) struct LoweredConstraints<'tcx> {
3232 pub ( crate ) type_tests : Vec < TypeTest < ' tcx > > ,
3333 pub ( crate ) liveness_constraints : LivenessValues ,
3434 pub ( crate ) universe_causes : FxIndexMap < UniverseIndex , UniverseInfo < ' tcx > > ,
35- pub ( crate ) placeholder_indices : PlaceholderIndices ,
3635}
3736
3837impl < ' d , ' tcx , A : scc:: Annotation > SccAnnotations < ' d , ' tcx , A > {
@@ -62,7 +61,7 @@ impl scc::Annotations<RegionVid> for SccAnnotations<'_, '_, RegionTracker> {
6261}
6362
6463#[ derive( Copy , Debug , Clone , PartialEq , Eq ) ]
65- enum PlaceholderReachability {
64+ pub ( crate ) enum PlaceholderReachability {
6665 /// This SCC reaches no placeholders.
6766 NoPlaceholders ,
6867 /// This SCC reaches at least one placeholder.
@@ -120,7 +119,7 @@ impl PlaceholderReachability {
120119/// the values of its elements. This annotates a single SCC.
121120#[ derive( Copy , Debug , Clone ) ]
122121pub ( crate ) struct RegionTracker {
123- reachable_placeholders : PlaceholderReachability ,
122+ pub ( crate ) reachable_placeholders : PlaceholderReachability ,
124123
125124 /// The smallest max nameable universe of all
126125 /// regions reachable from this SCC.
@@ -245,6 +244,16 @@ impl RegionTracker {
245244 PlaceholderReachability :: Placeholders { min_placeholder, .. } => Some ( min_placeholder) ,
246245 }
247246 }
247+
248+ /// If this SCC reaches at least one placeholder, return
249+ /// its region vid. If there's more than one, return the one
250+ /// with the smallest vid.
251+ pub ( crate ) fn reached_placeholder ( & self ) -> Option < RegionVid > {
252+ match self . reachable_placeholders {
253+ PlaceholderReachability :: NoPlaceholders => None ,
254+ PlaceholderReachability :: Placeholders { min_placeholder, .. } => Some ( min_placeholder) ,
255+ }
256+ }
248257}
249258
250259impl scc:: Annotation for RegionTracker {
@@ -350,12 +359,11 @@ pub(crate) fn compute_sccs_applying_placeholder_outlives_constraints<'tcx>(
350359 let ( definitions, has_placeholders) = region_definitions ( infcx, universal_regions) ;
351360
352361 let MirTypeckRegionConstraints {
353- placeholder_indices,
354- placeholder_index_to_region : _,
355362 liveness_constraints,
356363 mut outlives_constraints,
357364 universe_causes,
358365 type_tests,
366+ placeholder_to_region : _
359367 } = constraints;
360368
361369 let fr_static = universal_regions. fr_static ;
@@ -385,7 +393,6 @@ pub(crate) fn compute_sccs_applying_placeholder_outlives_constraints<'tcx>(
385393 outlives_constraints : Frozen :: freeze ( outlives_constraints) ,
386394 liveness_constraints,
387395 universe_causes,
388- placeholder_indices,
389396 } ;
390397 }
391398 debug ! ( "Placeholders present; activating placeholder handling logic!" ) ;
@@ -426,7 +433,6 @@ pub(crate) fn compute_sccs_applying_placeholder_outlives_constraints<'tcx>(
426433 type_tests,
427434 liveness_constraints,
428435 universe_causes,
429- placeholder_indices,
430436 }
431437}
432438
0 commit comments