]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/method/probe.rs
directly contain `PredicateAtom` in `PredicateKind::ForAll`
[rust.git] / src / librustc_typeck / check / method / probe.rs
index 9c5e3cbc93844a338f77c3c6977b26e59a520e63..106df847a05cff8ed93e835827a5c11a61fb5ec0 100644 (file)
@@ -798,25 +798,28 @@ fn assemble_inherent_candidates_from_param(&mut self, param_ty: ty::ParamTy) {
         // FIXME: do we want to commit to this behavior for param bounds?
         debug!("assemble_inherent_candidates_from_param(param_ty={:?})", param_ty);
 
-        let bounds = self.param_env.caller_bounds().iter().filter_map(|predicate| match predicate
-            .kind()
-        {
-            ty::PredicateKind::Trait(ref trait_predicate, _) => {
-                match trait_predicate.skip_binder().trait_ref.self_ty().kind {
-                    ty::Param(ref p) if *p == param_ty => Some(trait_predicate.to_poly_trait_ref()),
-                    _ => None,
-                }
-            }
-            ty::PredicateKind::Subtype(..)
-            | ty::PredicateKind::Projection(..)
-            | ty::PredicateKind::RegionOutlives(..)
-            | ty::PredicateKind::WellFormed(..)
-            | ty::PredicateKind::ObjectSafe(..)
-            | ty::PredicateKind::ClosureKind(..)
-            | ty::PredicateKind::TypeOutlives(..)
-            | ty::PredicateKind::ConstEvaluatable(..)
-            | ty::PredicateKind::ConstEquate(..) => None,
-        });
+        let bounds =
+            self.param_env.caller_bounds().iter().map(ty::Predicate::skip_binders).filter_map(
+                |predicate| match predicate {
+                    ty::PredicateAtom::Trait(trait_predicate, _) => {
+                        match trait_predicate.trait_ref.self_ty().kind {
+                            ty::Param(ref p) if *p == param_ty => {
+                                Some(ty::Binder::bind(trait_predicate.trait_ref))
+                            }
+                            _ => None,
+                        }
+                    }
+                    ty::PredicateAtom::Subtype(..)
+                    | ty::PredicateAtom::Projection(..)
+                    | ty::PredicateAtom::RegionOutlives(..)
+                    | ty::PredicateAtom::WellFormed(..)
+                    | ty::PredicateAtom::ObjectSafe(..)
+                    | ty::PredicateAtom::ClosureKind(..)
+                    | ty::PredicateAtom::TypeOutlives(..)
+                    | ty::PredicateAtom::ConstEvaluatable(..)
+                    | ty::PredicateAtom::ConstEquate(..) => None,
+                },
+            );
 
         self.elaborate_bounds(bounds, |this, poly_trait_ref, item| {
             let trait_ref = this.erase_late_bound_regions(&poly_trait_ref);