@@ -18,8 +18,8 @@ use crate::errors;
18
18
impl < ' tcx > dyn AstConv < ' tcx > + ' _ {
19
19
pub ( crate ) fn lower_where_predicates (
20
20
& self ,
21
- params : & ' tcx [ hir:: GenericParam < ' tcx > ] ,
22
- hir_predicates : & ' tcx [ hir:: WherePredicate < ' tcx > ] ,
21
+ params : & [ hir:: GenericParam < ' _ > ] ,
22
+ hir_predicates : & [ hir:: WherePredicate < ' _ > ] ,
23
23
predicates : & mut FxIndexSet < ( ty:: Clause < ' tcx > , Span ) > ,
24
24
) {
25
25
// Collect the predicates that were written inline by the user on each
@@ -140,19 +140,19 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
140
140
}
141
141
142
142
/// Sets `implicitly_sized` to true on `Bounds` if necessary
143
- pub ( crate ) fn add_implicitly_sized (
143
+ pub ( crate ) fn add_implicitly_sized < ' hir > (
144
144
& self ,
145
145
bounds : & mut Bounds < ' tcx > ,
146
146
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 > ] ) > ,
149
149
span : Span ,
150
150
) {
151
151
let tcx = self . tcx ( ) ;
152
152
153
153
// Try to find an unbound in bounds.
154
154
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 > ] | {
156
156
for ab in ast_bounds {
157
157
if let hir:: GenericBound :: Trait ( ptr, hir:: TraitBoundModifier :: Maybe ) = ab {
158
158
if unbound. is_none ( ) {
@@ -244,8 +244,16 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
244
244
hir:: TraitBoundModifier :: Maybe => continue ,
245
245
} ;
246
246
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
+ ) ) ;
249
257
250
258
let _ = self . instantiate_poly_trait_ref (
251
259
& poly_trait_ref. trait_ref ,
0 commit comments