@@ -480,13 +480,14 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> {
480480
481481impl < ' a > Clean < Option < WherePredicate > > for ty:: Predicate < ' a > {
482482 fn clean ( & self , cx : & DocContext < ' _ > ) -> Option < WherePredicate > {
483- match self . kind ( ) {
484- ty:: PredicateKind :: Trait ( ref pred, _) => Some ( pred. clean ( cx) ) ,
485- ty:: PredicateKind :: Subtype ( ref pred) => Some ( pred. clean ( cx) ) ,
486- ty:: PredicateKind :: RegionOutlives ( ref pred) => pred. clean ( cx) ,
487- ty:: PredicateKind :: TypeOutlives ( ref pred) => pred. clean ( cx) ,
488- ty:: PredicateKind :: Projection ( ref pred) => Some ( pred. clean ( cx) ) ,
489-
483+ match self . ignore_qualifiers ( ) . skip_binder ( ) . kind ( ) {
484+ & ty:: PredicateKind :: Trait ( pred, _) => Some ( ty:: Binder :: bind ( pred) . clean ( cx) ) ,
485+ & ty:: PredicateKind :: Subtype ( pred) => Some ( ty:: Binder :: bind ( pred) . clean ( cx) ) ,
486+ & ty:: PredicateKind :: RegionOutlives ( pred) => ty:: Binder :: bind ( pred) . clean ( cx) ,
487+ & ty:: PredicateKind :: TypeOutlives ( pred) => ty:: Binder :: bind ( pred) . clean ( cx) ,
488+ & ty:: PredicateKind :: Projection ( pred) => Some ( ty:: Binder :: bind ( pred) . clean ( cx) ) ,
489+
490+ ty:: PredicateKind :: ForAll ( _) => panic ! ( "unexpected predicate: {:?}" , self ) ,
490491 ty:: PredicateKind :: WellFormed ( ..)
491492 | ty:: PredicateKind :: ObjectSafe ( ..)
492493 | ty:: PredicateKind :: ClosureKind ( ..)
@@ -754,19 +755,24 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
754755 . flat_map ( |( p, _) | {
755756 let mut projection = None ;
756757 let param_idx = ( || {
757- if let Some ( trait_ref) = p. to_opt_poly_trait_ref ( ) {
758- if let ty:: Param ( param) = trait_ref. skip_binder ( ) . self_ty ( ) . kind {
759- return Some ( param. index ) ;
758+ match p. ignore_qualifiers ( ) . skip_binder ( ) . kind ( ) {
759+ & ty:: PredicateKind :: Trait ( pred, _constness) => {
760+ if let ty:: Param ( param) = pred. self_ty ( ) . kind {
761+ return Some ( param. index ) ;
762+ }
760763 }
761- } else if let Some ( outlives) = p. to_opt_type_outlives ( ) {
762- if let ty:: Param ( param) = outlives. skip_binder ( ) . 0 . kind {
763- return Some ( param. index ) ;
764+ & ty:: PredicateKind :: TypeOutlives ( ty:: OutlivesPredicate ( ty, _reg) ) => {
765+ if let ty:: Param ( param) = ty. kind {
766+ return Some ( param. index ) ;
767+ }
764768 }
765- } else if let ty:: PredicateKind :: Projection ( p) = p. kind ( ) {
766- if let ty:: Param ( param) = p. skip_binder ( ) . projection_ty . self_ty ( ) . kind {
767- projection = Some ( p) ;
768- return Some ( param. index ) ;
769+ & ty:: PredicateKind :: Projection ( p) => {
770+ if let ty:: Param ( param) = p. projection_ty . self_ty ( ) . kind {
771+ projection = Some ( ty:: Binder :: bind ( p) ) ;
772+ return Some ( param. index ) ;
773+ }
769774 }
775+ _ => ( ) ,
770776 }
771777
772778 None
@@ -1657,7 +1663,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16571663 . filter_map ( |predicate| {
16581664 let trait_ref = if let Some ( tr) = predicate. to_opt_poly_trait_ref ( ) {
16591665 tr
1660- } else if let ty :: PredicateKind :: TypeOutlives ( pred) = predicate. kind ( ) {
1666+ } else if let Some ( pred) = predicate. to_opt_type_outlives ( ) {
16611667 // these should turn up at the end
16621668 if let Some ( r) = pred. skip_binder ( ) . 1 . clean ( cx) {
16631669 regions. push ( GenericBound :: Outlives ( r) ) ;
@@ -1678,8 +1684,10 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
16781684 . predicates
16791685 . iter ( )
16801686 . filter_map ( |pred| {
1681- if let ty:: PredicateKind :: Projection ( proj) = pred. kind ( ) {
1682- let proj = proj. skip_binder ( ) ;
1687+ if let ty:: PredicateKind :: Projection ( proj) =
1688+ pred. ignore_qualifiers ( ) . skip_binder ( ) . kind ( )
1689+ {
1690+ let proj = proj;
16831691 if proj. projection_ty . trait_ref ( cx. tcx )
16841692 == trait_ref. skip_binder ( )
16851693 {
0 commit comments