@@ -307,26 +307,27 @@ fn clean_where_predicate<'tcx>(
307
307
} )
308
308
}
309
309
310
- impl < ' tcx > Clean < ' tcx , Option < WherePredicate > > for ty:: Predicate < ' tcx > {
311
- fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> Option < WherePredicate > {
312
- let bound_predicate = self . kind ( ) ;
313
- match bound_predicate. skip_binder ( ) {
314
- ty:: PredicateKind :: Trait ( pred) => {
315
- clean_poly_trait_predicate ( bound_predicate. rebind ( pred) , cx)
316
- }
317
- ty:: PredicateKind :: RegionOutlives ( pred) => clean_region_outlives_predicate ( pred) ,
318
- ty:: PredicateKind :: TypeOutlives ( pred) => clean_type_outlives_predicate ( pred, cx) ,
319
- ty:: PredicateKind :: Projection ( pred) => Some ( clean_projection_predicate ( pred, cx) ) ,
320
- ty:: PredicateKind :: ConstEvaluatable ( ..) => None ,
321
- ty:: PredicateKind :: WellFormed ( ..) => None ,
322
-
323
- ty:: PredicateKind :: Subtype ( ..)
324
- | ty:: PredicateKind :: Coerce ( ..)
325
- | ty:: PredicateKind :: ObjectSafe ( ..)
326
- | ty:: PredicateKind :: ClosureKind ( ..)
327
- | ty:: PredicateKind :: ConstEquate ( ..)
328
- | ty:: PredicateKind :: TypeWellFormedFromEnv ( ..) => panic ! ( "not user writable" ) ,
310
+ pub ( crate ) fn clean_predicate < ' tcx > (
311
+ predicate : ty:: Predicate < ' tcx > ,
312
+ cx : & mut DocContext < ' tcx > ,
313
+ ) -> Option < WherePredicate > {
314
+ let bound_predicate = predicate. kind ( ) ;
315
+ match bound_predicate. skip_binder ( ) {
316
+ ty:: PredicateKind :: Trait ( pred) => {
317
+ clean_poly_trait_predicate ( bound_predicate. rebind ( pred) , cx)
329
318
}
319
+ ty:: PredicateKind :: RegionOutlives ( pred) => clean_region_outlives_predicate ( pred) ,
320
+ ty:: PredicateKind :: TypeOutlives ( pred) => clean_type_outlives_predicate ( pred, cx) ,
321
+ ty:: PredicateKind :: Projection ( pred) => Some ( clean_projection_predicate ( pred, cx) ) ,
322
+ ty:: PredicateKind :: ConstEvaluatable ( ..) => None ,
323
+ ty:: PredicateKind :: WellFormed ( ..) => None ,
324
+
325
+ ty:: PredicateKind :: Subtype ( ..)
326
+ | ty:: PredicateKind :: Coerce ( ..)
327
+ | ty:: PredicateKind :: ObjectSafe ( ..)
328
+ | ty:: PredicateKind :: ClosureKind ( ..)
329
+ | ty:: PredicateKind :: ConstEquate ( ..)
330
+ | ty:: PredicateKind :: TypeWellFormedFromEnv ( ..) => panic ! ( "not user writable" ) ,
330
331
}
331
332
}
332
333
@@ -707,7 +708,7 @@ fn clean_ty_generics<'tcx>(
707
708
708
709
if let Some ( param_idx) = param_idx {
709
710
if let Some ( b) = impl_trait. get_mut ( & param_idx. into ( ) ) {
710
- let p: WherePredicate = p . clean ( cx) ?;
711
+ let p: WherePredicate = clean_predicate ( * p , cx) ?;
711
712
712
713
b. extend (
713
714
p. get_bounds ( )
@@ -764,7 +765,7 @@ fn clean_ty_generics<'tcx>(
764
765
// Now that `cx.impl_trait_bounds` is populated, we can process
765
766
// remaining predicates which could contain `impl Trait`.
766
767
let mut where_predicates =
767
- where_predicates. into_iter ( ) . flat_map ( |p| p . clean ( cx) ) . collect :: < Vec < _ > > ( ) ;
768
+ where_predicates. into_iter ( ) . flat_map ( |p| clean_predicate ( * p , cx) ) . collect :: < Vec < _ > > ( ) ;
768
769
769
770
// Type parameters have a Sized bound by default unless removed with
770
771
// ?Sized. Scan through the predicates and mark any type parameter with
0 commit comments