@@ -6,6 +6,7 @@ use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
6
6
use rustc_infer:: infer:: { self , InferCtxt , SubregionOrigin } ;
7
7
use rustc_middle:: mir:: ConstraintCategory ;
8
8
use rustc_middle:: ty:: subst:: GenericArgKind ;
9
+ use rustc_middle:: ty:: TypeFoldable ;
9
10
use rustc_middle:: ty:: { self , TyCtxt } ;
10
11
use rustc_span:: DUMMY_SP ;
11
12
@@ -95,11 +96,23 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
95
96
self . add_outlives ( r1_vid, r2_vid) ;
96
97
}
97
98
98
- GenericArgKind :: Type ( t1) => {
99
+ GenericArgKind :: Type ( mut t1) => {
99
100
// we don't actually use this for anything, but
100
101
// the `TypeOutlives` code needs an origin.
101
102
let origin = infer:: RelateParamBound ( DUMMY_SP , t1, None ) ;
102
103
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
+
103
116
TypeOutlives :: new (
104
117
& mut * self ,
105
118
tcx,
0 commit comments