@@ -1611,8 +1611,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1611
1611
& self ,
1612
1612
from_region : RegionVid ,
1613
1613
to_region : RegionVid ,
1614
- ) -> Option < ( Vec < OutlivesConstraint < ' tcx > > , RegionVid ) > {
1615
- self . constraint_path_to ( from_region, |to| to == to_region, true )
1614
+ ) -> Option < Vec < OutlivesConstraint < ' tcx > > > {
1615
+ self . constraint_path_to ( from_region, |to| to == to_region, true ) . map ( |o| o . 0 )
1616
1616
}
1617
1617
1618
1618
/// Walks the graph of constraints (where `'a: 'b` is considered
@@ -1805,15 +1805,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1805
1805
/// r2 has a larger universe or if r1 and r2 both come from
1806
1806
/// placeholder regions.
1807
1807
///
1808
- /// Returns the path and the target region, which may or may
1809
- /// not be the original `to`. It panics if there is no such
1810
- /// path.
1808
+ /// Returns the path. It panics if there is no such path.
1811
1809
fn path_to_modulo_placeholders (
1812
1810
& self ,
1813
1811
from : RegionVid ,
1814
1812
to : RegionVid ,
1815
- ) -> ( Vec < OutlivesConstraint < ' tcx > > , RegionVid ) {
1816
- let path = self . constraint_path_between_regions ( from, to) . unwrap ( ) . 0 ;
1813
+ ) -> Vec < OutlivesConstraint < ' tcx > > {
1814
+ let path = self . constraint_path_between_regions ( from, to) . unwrap ( ) ;
1817
1815
1818
1816
// If we are looking for a path to 'static, and we are passing
1819
1817
// through a constraint synthesised from an illegal placeholder
@@ -1826,13 +1824,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1826
1824
} ;
1827
1825
1828
1826
debug ! ( "{culprit:?} is the reason {from:?}: 'static!" ) ;
1829
- // FIXME: think: this may be for transitive reasons and
1830
- // we may have to do this arbitrarily many times. Or may we?
1831
- return self . constraint_path_to ( cl_fr, |r| r == culprit, false ) . unwrap ( ) ;
1827
+ return self . constraint_path_to ( cl_fr, |r| r == culprit, false ) . unwrap ( ) . 0 ;
1832
1828
}
1833
1829
1834
1830
// No funny business; just return the path!
1835
- ( path, to )
1831
+ path
1836
1832
}
1837
1833
1838
1834
/// Tries to find the best constraint to blame for the fact that
@@ -1851,7 +1847,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1851
1847
// Find all paths
1852
1848
assert ! ( from_region != to_region, "Trying to blame a region for itself!" ) ;
1853
1849
1854
- let ( path, new_to_region ) = self . path_to_modulo_placeholders ( from_region, to_region) ;
1850
+ let path = self . path_to_modulo_placeholders ( from_region, to_region) ;
1855
1851
debug ! (
1856
1852
"path={:#?}" ,
1857
1853
path. iter( )
@@ -1954,7 +1950,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1954
1950
ConstraintCategory :: Cast {
1955
1951
unsize_to : Some ( unsize_ty) ,
1956
1952
is_implicit_coercion : true ,
1957
- } if new_to_region == self . universal_regions ( ) . fr_static
1953
+ } if to_region == self . universal_regions ( ) . fr_static
1958
1954
// Mirror the note's condition, to minimize how often this diverts blame.
1959
1955
&& let ty:: Adt ( _, args) = unsize_ty. kind ( )
1960
1956
&& args. iter ( ) . any ( |arg| arg. as_type ( ) . is_some_and ( |ty| ty. is_trait ( ) ) )
@@ -2029,6 +2025,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2029
2025
path[ best_choice]
2030
2026
} ;
2031
2027
2028
+ assert ! (
2029
+ !matches!( best_constraint. category, ConstraintCategory :: IllegalPlaceholder ( _, _) ) ,
2030
+ "Illegal placeholder constraint blamed; should have redirected to other region relation"
2031
+ ) ;
2032
+
2032
2033
let blame_constraint = BlameConstraint {
2033
2034
category : best_constraint. category ,
2034
2035
from_closure : best_constraint. from_closure ,
0 commit comments