@@ -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 unbound = None ;
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 if unbound. is_none ( ) {
@@ -244,8 +244,16 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
244244 hir:: TraitBoundModifier :: Maybe => continue ,
245245 } ;
246246
247- // TODO: Add in the binder preds from the poly trait ref.
248- let binder_predicates = binder_predicates;
247+ let mut additional_binder_predicates = FxIndexSet :: default ( ) ;
248+ self . lower_where_predicates (
249+ poly_trait_ref. bound_generic_params ,
250+ poly_trait_ref. binder_predicates ,
251+ & mut additional_binder_predicates,
252+ ) ;
253+ let binder_predicates =
254+ self . tcx ( ) . mk_clauses_from_iter ( binder_predicates. into_iter ( ) . chain (
255+ additional_binder_predicates. into_iter ( ) . map ( |( clause, _) | clause) ,
256+ ) ) ;
249257
250258 let _ = self . instantiate_poly_trait_ref (
251259 & poly_trait_ref. trait_ref ,
0 commit comments