about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/clean/auto_trait.rs10
-rw-r--r--src/librustdoc/clean/mod.rs48
-rw-r--r--src/librustdoc/clean/simplify.rs9
3 files changed, 36 insertions, 31 deletions
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs
index ddd27d42df4..d49afb551bd 100644
--- a/src/librustdoc/clean/auto_trait.rs
+++ b/src/librustdoc/clean/auto_trait.rs
@@ -315,12 +315,12 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
         tcx: TyCtxt<'tcx>,
         pred: ty::Predicate<'tcx>,
     ) -> FxHashSet<GenericParamDef> {
-        let regions = match pred.kind() {
-            ty::PredicateKind::Trait(poly_trait_pred, _) => {
-                tcx.collect_referenced_late_bound_regions(&poly_trait_pred)
+        let regions = match pred.ignore_qualifiers().skip_binder().kind() {
+            &ty::PredicateKind::Trait(poly_trait_pred, _) => {
+                tcx.collect_referenced_late_bound_regions(&ty::Binder::bind(poly_trait_pred))
             }
-            ty::PredicateKind::Projection(poly_proj_pred) => {
-                tcx.collect_referenced_late_bound_regions(&poly_proj_pred)
+            &ty::PredicateKind::Projection(poly_proj_pred) => {
+                tcx.collect_referenced_late_bound_regions(&ty::Binder::bind(poly_proj_pred))
             }
             _ => return FxHashSet::default(),
         };
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 94d95115dcd..fdfdddea006 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -480,13 +480,14 @@ impl Clean<WherePredicate> for hir::WherePredicate<'_> {
 
 impl<'a> Clean<Option<WherePredicate>> for ty::Predicate<'a> {
     fn clean(&self, cx: &DocContext<'_>) -> Option<WherePredicate> {
-        match self.kind() {
-            ty::PredicateKind::Trait(ref pred, _) => Some(pred.clean(cx)),
-            ty::PredicateKind::Subtype(ref pred) => Some(pred.clean(cx)),
-            ty::PredicateKind::RegionOutlives(ref pred) => pred.clean(cx),
-            ty::PredicateKind::TypeOutlives(ref pred) => pred.clean(cx),
-            ty::PredicateKind::Projection(ref pred) => Some(pred.clean(cx)),
-
+        match self.ignore_qualifiers().skip_binder().kind() {
+            &ty::PredicateKind::Trait(pred, _) => Some(ty::Binder::bind(pred).clean(cx)),
+            &ty::PredicateKind::Subtype(pred) => Some(ty::Binder::bind(pred).clean(cx)),
+            &ty::PredicateKind::RegionOutlives(pred) => ty::Binder::bind(pred).clean(cx),
+            &ty::PredicateKind::TypeOutlives(pred) => ty::Binder::bind(pred).clean(cx),
+            &ty::PredicateKind::Projection(pred) => Some(ty::Binder::bind(pred).clean(cx)),
+
+            ty::PredicateKind::ForAll(_) => panic!("unexpected predicate: {:?}", self),
             ty::PredicateKind::WellFormed(..)
             | ty::PredicateKind::ObjectSafe(..)
             | ty::PredicateKind::ClosureKind(..)
@@ -754,19 +755,24 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics, ty::GenericPredicates<'tcx
             .flat_map(|(p, _)| {
                 let mut projection = None;
                 let param_idx = (|| {
-                    if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
-                        if let ty::Param(param) = trait_ref.skip_binder().self_ty().kind {
-                            return Some(param.index);
+                    match p.ignore_qualifiers().skip_binder().kind() {
+                        &ty::PredicateKind::Trait(pred, _constness) => {
+                            if let ty::Param(param) = pred.self_ty().kind {
+                                return Some(param.index);
+                            }
                         }
-                    } else if let Some(outlives) = p.to_opt_type_outlives() {
-                        if let ty::Param(param) = outlives.skip_binder().0.kind {
-                            return Some(param.index);
+                        &ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty, _reg)) => {
+                            if let ty::Param(param) = ty.kind {
+                                return Some(param.index);
+                            }
                         }
-                    } else if let ty::PredicateKind::Projection(p) = p.kind() {
-                        if let ty::Param(param) = p.skip_binder().projection_ty.self_ty().kind {
-                            projection = Some(p);
-                            return Some(param.index);
+                        &ty::PredicateKind::Projection(p) => {
+                            if let ty::Param(param) = p.projection_ty.self_ty().kind {
+                                projection = Some(ty::Binder::bind(p));
+                                return Some(param.index);
+                            }
                         }
+                        _ => (),
                     }
 
                     None
@@ -1657,7 +1663,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
                     .filter_map(|predicate| {
                         let trait_ref = if let Some(tr) = predicate.to_opt_poly_trait_ref() {
                             tr
-                        } else if let ty::PredicateKind::TypeOutlives(pred) = predicate.kind() {
+                        } else if let Some(pred) = predicate.to_opt_type_outlives() {
                             // these should turn up at the end
                             if let Some(r) = pred.skip_binder().1.clean(cx) {
                                 regions.push(GenericBound::Outlives(r));
@@ -1678,8 +1684,10 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
                             .predicates
                             .iter()
                             .filter_map(|pred| {
-                                if let ty::PredicateKind::Projection(proj) = pred.kind() {
-                                    let proj = proj.skip_binder();
+                                if let ty::PredicateKind::Projection(proj) =
+                                    pred.ignore_qualifiers().skip_binder().kind()
+                                {
+                                    let proj = proj;
                                     if proj.projection_ty.trait_ref(cx.tcx)
                                         == trait_ref.skip_binder()
                                     {
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index 37c613f4122..75c5fb4c9f8 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -141,12 +141,9 @@ fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId)
         .predicates
         .iter()
         .filter_map(|(pred, _)| {
-            if let ty::PredicateKind::Trait(ref pred, _) = pred.kind() {
-                if pred.skip_binder().trait_ref.self_ty() == self_ty {
-                    Some(pred.def_id())
-                } else {
-                    None
-                }
+            if let ty::PredicateKind::Trait(pred, _) = pred.ignore_qualifiers().skip_binder().kind()
+            {
+                if pred.trait_ref.self_ty() == self_ty { Some(pred.def_id()) } else { None }
             } else {
                 None
             }