@@ -37,11 +37,11 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
37
37
}
38
38
39
39
#[ instrument( level = "debug" , skip( self ) ) ]
40
- pub fn param_bound ( & self , param_ty : ty:: ParamTy ) -> VerifyBound < ' tcx > {
40
+ pub fn param_or_placeholder_bound ( & self , ty : Ty < ' tcx > ) -> VerifyBound < ' tcx > {
41
41
// Start with anything like `T: 'a` we can scrape from the
42
42
// environment. If the environment contains something like
43
43
// `for<'a> T: 'a`, then we know that `T` outlives everything.
44
- let declared_bounds_from_env = self . declared_generic_bounds_from_env ( param_ty ) ;
44
+ let declared_bounds_from_env = self . declared_generic_bounds_from_env ( ty ) ;
45
45
debug ! ( ?declared_bounds_from_env) ;
46
46
let mut param_bounds = vec ! [ ] ;
47
47
for declared_bound in declared_bounds_from_env {
@@ -51,7 +51,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
51
51
param_bounds. push ( VerifyBound :: OutlivedBy ( region) ) ;
52
52
} else {
53
53
// This is `for<'a> T: 'a`. This means that `T` outlives everything! All done here.
54
- debug ! ( "found that {param_ty :?} outlives any lifetime, returning empty vector" ) ;
54
+ debug ! ( "found that {ty :?} outlives any lifetime, returning empty vector" ) ;
55
55
return VerifyBound :: AllBounds ( vec ! [ ] ) ;
56
56
}
57
57
}
@@ -168,7 +168,10 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
168
168
) -> VerifyBound < ' tcx > {
169
169
match * component {
170
170
Component :: Region ( lt) => VerifyBound :: OutlivedBy ( lt) ,
171
- Component :: Param ( param_ty) => self . param_bound ( param_ty) ,
171
+ Component :: Param ( param_ty) => self . param_or_placeholder_bound ( param_ty. to_ty ( self . tcx ) ) ,
172
+ Component :: Placeholder ( placeholder_ty) => {
173
+ self . param_or_placeholder_bound ( Ty :: new_placeholder ( self . tcx , placeholder_ty) )
174
+ }
172
175
Component :: Alias ( alias_ty) => self . alias_bound ( alias_ty, visited) ,
173
176
Component :: EscapingAlias ( ref components) => {
174
177
self . bound_from_components ( components, visited)
@@ -195,9 +198,9 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
195
198
/// bounds, but all the bounds it returns can be relied upon.
196
199
fn declared_generic_bounds_from_env (
197
200
& self ,
198
- param_ty : ty :: ParamTy ,
201
+ generic_ty : Ty < ' tcx > ,
199
202
) -> Vec < ty:: Binder < ' tcx , ty:: OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > > > {
200
- let generic_ty = param_ty . to_ty ( self . tcx ) ;
203
+ assert ! ( matches! ( generic_ty. kind ( ) , ty :: Param ( _ ) | ty :: Placeholder ( _ ) ) ) ;
201
204
self . declared_generic_bounds_from_env_for_erased_ty ( generic_ty)
202
205
}
203
206
0 commit comments