@@ -18,8 +18,8 @@ use crate::errors;
1818impl < ' tcx > dyn AstConv < ' tcx > + ' _ {
1919 pub ( crate ) fn lower_where_predicates (
2020 & self ,
21- params : & ' tcx [ hir:: GenericParam < ' tcx > ] ,
22- hir_predicates : & ' tcx [ hir:: WherePredicate < ' tcx > ] ,
21+ params : & [ hir:: GenericParam < ' _ > ] ,
22+ hir_predicates : & [ hir:: WherePredicate < ' _ > ] ,
2323 predicates : & mut FxIndexSet < ( ty:: Clause < ' tcx > , Span ) > ,
2424 ) {
2525 // Collect the predicates that were written inline by the user on each
@@ -140,19 +140,19 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
140140 }
141141
142142 /// Sets `implicitly_sized` to true on `Bounds` if necessary
143- pub ( crate ) fn add_implicitly_sized (
143+ pub ( crate ) fn add_implicitly_sized < ' hir > (
144144 & self ,
145145 bounds : & mut Bounds < ' tcx > ,
146146 self_ty : Ty < ' tcx > ,
147- ast_bounds : & ' tcx [ hir:: GenericBound < ' tcx > ] ,
148- self_ty_where_predicates : Option < ( LocalDefId , & ' tcx [ hir:: WherePredicate < ' tcx > ] ) > ,
147+ ast_bounds : & ' hir [ hir:: GenericBound < ' hir > ] ,
148+ self_ty_where_predicates : Option < ( LocalDefId , & ' hir [ hir:: WherePredicate < ' hir > ] ) > ,
149149 span : Span ,
150150 ) {
151151 let tcx = self . tcx ( ) ;
152152
153153 // Try to find an unbound in bounds.
154154 let mut unbounds: SmallVec < [ _ ; 1 ] > = SmallVec :: new ( ) ;
155- let mut search_bounds = |ast_bounds : & ' tcx [ hir:: GenericBound < ' tcx > ] | {
155+ let mut search_bounds = |ast_bounds : & ' hir [ hir:: GenericBound < ' hir > ] | {
156156 for ab in ast_bounds {
157157 if let hir:: GenericBound :: Trait ( ptr, hir:: TraitBoundModifier :: Maybe ) = ab {
158158 unbounds. push ( ptr) ;
@@ -248,8 +248,16 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
248248 hir:: TraitBoundModifier :: Maybe => continue ,
249249 } ;
250250
251- // TODO: Add in the binder preds from the poly trait ref.
252- let binder_predicates = binder_predicates;
251+ let mut additional_binder_predicates = FxIndexSet :: default ( ) ;
252+ self . lower_where_predicates (
253+ poly_trait_ref. bound_generic_params ,
254+ poly_trait_ref. binder_predicates ,
255+ & mut additional_binder_predicates,
256+ ) ;
257+ let binder_predicates =
258+ self . tcx ( ) . mk_clauses_from_iter ( binder_predicates. into_iter ( ) . chain (
259+ additional_binder_predicates. into_iter ( ) . map ( |( clause, _) | clause) ,
260+ ) ) ;
253261
254262 let _ = self . instantiate_poly_trait_ref (
255263 & poly_trait_ref. trait_ref ,
0 commit comments