@@ -37,11 +37,11 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
3737 }
3838
3939 #[ 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 > {
4141 // Start with anything like `T: 'a` we can scrape from the
4242 // environment. If the environment contains something like
4343 // `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 ) ;
4545 debug ! ( ?declared_bounds_from_env) ;
4646 let mut param_bounds = vec ! [ ] ;
4747 for declared_bound in declared_bounds_from_env {
@@ -51,7 +51,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
5151 param_bounds. push ( VerifyBound :: OutlivedBy ( region) ) ;
5252 } else {
5353 // 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" ) ;
5555 return VerifyBound :: AllBounds ( vec ! [ ] ) ;
5656 }
5757 }
@@ -168,7 +168,10 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
168168 ) -> VerifyBound < ' tcx > {
169169 match * component {
170170 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+ }
172175 Component :: Alias ( alias_ty) => self . alias_bound ( alias_ty, visited) ,
173176 Component :: EscapingAlias ( ref components) => {
174177 self . bound_from_components ( components, visited)
@@ -195,9 +198,9 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> {
195198 /// bounds, but all the bounds it returns can be relied upon.
196199 fn declared_generic_bounds_from_env (
197200 & self ,
198- param_ty : ty :: ParamTy ,
201+ generic_ty : Ty < ' tcx > ,
199202 ) -> 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 ( _ ) ) ) ;
201204 self . declared_generic_bounds_from_env_for_erased_ty ( generic_ty)
202205 }
203206
0 commit comments