@@ -1611,8 +1611,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
16111611 & self ,
16121612 from_region : RegionVid ,
16131613 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 )
16161616 }
16171617
16181618 /// Walks the graph of constraints (where `'a: 'b` is considered
@@ -1805,15 +1805,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
18051805 /// r2 has a larger universe or if r1 and r2 both come from
18061806 /// placeholder regions.
18071807 ///
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.
18111809 fn path_to_modulo_placeholders (
18121810 & self ,
18131811 from : RegionVid ,
18141812 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 ( ) ;
18171815
18181816 // If we are looking for a path to 'static, and we are passing
18191817 // through a constraint synthesised from an illegal placeholder
@@ -1826,13 +1824,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
18261824 } ;
18271825
18281826 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 ;
18321828 }
18331829
18341830 // No funny business; just return the path!
1835- ( path, to )
1831+ path
18361832 }
18371833
18381834 /// Tries to find the best constraint to blame for the fact that
@@ -1851,7 +1847,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
18511847 // Find all paths
18521848 assert ! ( from_region != to_region, "Trying to blame a region for itself!" ) ;
18531849
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) ;
18551851 debug ! (
18561852 "path={:#?}" ,
18571853 path. iter( )
@@ -1954,7 +1950,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19541950 ConstraintCategory :: Cast {
19551951 unsize_to : Some ( unsize_ty) ,
19561952 is_implicit_coercion : true ,
1957- } if new_to_region == self . universal_regions ( ) . fr_static
1953+ } if to_region == self . universal_regions ( ) . fr_static
19581954 // Mirror the note's condition, to minimize how often this diverts blame.
19591955 && let ty:: Adt ( _, args) = unsize_ty. kind ( )
19601956 && args. iter ( ) . any ( |arg| arg. as_type ( ) . is_some_and ( |ty| ty. is_trait ( ) ) )
@@ -2029,6 +2025,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
20292025 path[ best_choice]
20302026 } ;
20312027
2028+ assert ! (
2029+ !matches!( best_constraint. category, ConstraintCategory :: IllegalPlaceholder ( _, _) ) ,
2030+ "Illegal placeholder constraint blamed; should have redirected to other region relation"
2031+ ) ;
2032+
20322033 let blame_constraint = BlameConstraint {
20332034 category : best_constraint. category ,
20342035 from_closure : best_constraint. from_closure ,
0 commit comments