@@ -6,6 +6,7 @@ use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
66use rustc_infer:: infer:: { self , InferCtxt , SubregionOrigin } ;
77use rustc_middle:: mir:: ConstraintCategory ;
88use rustc_middle:: ty:: subst:: GenericArgKind ;
9+ use rustc_middle:: ty:: TypeFoldable ;
910use rustc_middle:: ty:: { self , TyCtxt } ;
1011use rustc_span:: DUMMY_SP ;
1112
@@ -95,11 +96,23 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
9596 self . add_outlives ( r1_vid, r2_vid) ;
9697 }
9798
98- GenericArgKind :: Type ( t1) => {
99+ GenericArgKind :: Type ( mut t1) => {
99100 // we don't actually use this for anything, but
100101 // the `TypeOutlives` code needs an origin.
101102 let origin = infer:: RelateParamBound ( DUMMY_SP , t1, None ) ;
102103
104+ // Placeholder regions need to be converted now because it may
105+ // create new region variables, which can't be done later when
106+ // verifying these bounds.
107+ if t1. has_placeholders ( ) {
108+ t1 = tcx. fold_regions ( & t1, & mut false , |r, _| match * r {
109+ ty:: RegionKind :: RePlaceholder ( placeholder) => {
110+ self . constraints . placeholder_region ( self . infcx , placeholder)
111+ }
112+ _ => r,
113+ } ) ;
114+ }
115+
103116 TypeOutlives :: new (
104117 & mut * self ,
105118 tcx,
0 commit comments