@@ -245,6 +245,9 @@ enum Trace<'tcx> {
245
245
NotVisited ,
246
246
}
247
247
248
+ #[ derive( Clone , PartialEq , Eq , Debug ) ]
249
+ pub enum ExtraConstraintInfo { }
250
+
248
251
impl < ' tcx > RegionInferenceContext < ' tcx > {
249
252
/// Creates a new region inference context with a total of
250
253
/// `num_region_variables` valid inference variables; the first N
@@ -1818,10 +1821,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1818
1821
fr1_origin : NllRegionVariableOrigin ,
1819
1822
fr2 : RegionVid ,
1820
1823
) -> ( ConstraintCategory < ' tcx > , ObligationCause < ' tcx > ) {
1821
- let BlameConstraint { category, cause, .. } =
1822
- self . best_blame_constraint ( fr1, fr1_origin, |r| {
1823
- self . provides_universal_region ( r, fr1, fr2)
1824
- } ) ;
1824
+ let BlameConstraint { category, cause, .. } = self
1825
+ . best_blame_constraint ( fr1, fr1_origin, |r| self . provides_universal_region ( r, fr1, fr2) )
1826
+ . 0 ;
1825
1827
( category, cause)
1826
1828
}
1827
1829
@@ -2010,7 +2012,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2010
2012
from_region : RegionVid ,
2011
2013
from_region_origin : NllRegionVariableOrigin ,
2012
2014
target_test : impl Fn ( RegionVid ) -> bool ,
2013
- ) -> BlameConstraint < ' tcx > {
2015
+ ) -> ( BlameConstraint < ' tcx > , Vec < ExtraConstraintInfo > ) {
2014
2016
// Find all paths
2015
2017
let ( path, target_region) =
2016
2018
self . find_constraint_paths_between_regions ( from_region, target_test) . unwrap ( ) ;
@@ -2026,6 +2028,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2026
2028
. collect:: <Vec <_>>( )
2027
2029
) ;
2028
2030
2031
+ let extra_info = vec ! [ ] ;
2032
+
2029
2033
// We try to avoid reporting a `ConstraintCategory::Predicate` as our best constraint.
2030
2034
// Instead, we use it to produce an improved `ObligationCauseCode`.
2031
2035
// FIXME - determine what we should do if we encounter multiple `ConstraintCategory::Predicate`
@@ -2175,7 +2179,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2175
2179
let best_choice =
2176
2180
if blame_source { range. rev ( ) . find ( find_region) } else { range. find ( find_region) } ;
2177
2181
2178
- debug ! ( ?best_choice, ?blame_source) ;
2182
+ debug ! ( ?best_choice, ?blame_source, ?extra_info ) ;
2179
2183
2180
2184
if let Some ( i) = best_choice {
2181
2185
if let Some ( next) = categorized_path. get ( i + 1 ) {
@@ -2184,7 +2188,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2184
2188
{
2185
2189
// The return expression is being influenced by the return type being
2186
2190
// impl Trait, point at the return type and not the return expr.
2187
- return next. clone ( ) ;
2191
+ return ( next. clone ( ) , extra_info ) ;
2188
2192
}
2189
2193
}
2190
2194
@@ -2204,7 +2208,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2204
2208
}
2205
2209
}
2206
2210
2207
- return categorized_path[ i] . clone ( ) ;
2211
+ return ( categorized_path[ i] . clone ( ) , extra_info ) ;
2208
2212
}
2209
2213
2210
2214
// If that search fails, that is.. unusual. Maybe everything
@@ -2214,7 +2218,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2214
2218
categorized_path. sort_by ( |p0, p1| p0. category . cmp ( & p1. category ) ) ;
2215
2219
debug ! ( "sorted_path={:#?}" , categorized_path) ;
2216
2220
2217
- categorized_path. remove ( 0 )
2221
+ ( categorized_path. remove ( 0 ) , extra_info )
2218
2222
}
2219
2223
2220
2224
pub ( crate ) fn universe_info ( & self , universe : ty:: UniverseIndex ) -> UniverseInfo < ' tcx > {
0 commit comments