@@ -480,13 +480,14 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> {
480
480
481
481
impl < ' a > Clean < Option < WherePredicate > > for ty:: Predicate < ' a > {
482
482
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 ) ,
490
491
ty:: PredicateKind :: WellFormed ( ..)
491
492
| ty:: PredicateKind :: ObjectSafe ( ..)
492
493
| ty:: PredicateKind :: ClosureKind ( ..)
@@ -754,19 +755,24 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
754
755
. flat_map ( |( p, _) | {
755
756
let mut projection = None ;
756
757
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
+ }
760
763
}
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
+ }
764
768
}
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
+ }
769
774
}
775
+ _ => ( ) ,
770
776
}
771
777
772
778
None
@@ -1655,7 +1661,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1655
1661
. filter_map ( |predicate| {
1656
1662
let trait_ref = if let Some ( tr) = predicate. to_opt_poly_trait_ref ( ) {
1657
1663
tr
1658
- } else if let ty :: PredicateKind :: TypeOutlives ( pred) = predicate. kind ( ) {
1664
+ } else if let Some ( pred) = predicate. to_opt_type_outlives ( ) {
1659
1665
// these should turn up at the end
1660
1666
if let Some ( r) = pred. skip_binder ( ) . 1 . clean ( cx) {
1661
1667
regions. push ( GenericBound :: Outlives ( r) ) ;
@@ -1676,8 +1682,10 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1676
1682
. predicates
1677
1683
. iter ( )
1678
1684
. filter_map ( |pred| {
1679
- if let ty:: PredicateKind :: Projection ( proj) = pred. kind ( ) {
1680
- let proj = proj. skip_binder ( ) ;
1685
+ if let ty:: PredicateKind :: Projection ( proj) =
1686
+ pred. ignore_qualifiers ( ) . skip_binder ( ) . kind ( )
1687
+ {
1688
+ let proj = proj;
1681
1689
if proj. projection_ty . trait_ref ( cx. tcx )
1682
1690
== * trait_ref. skip_binder ( )
1683
1691
{
0 commit comments