]> 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 ba952df7e4e2861dc1b914c59d3e56f057cc1c9f..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);
@@ -1536,7 +1539,7 @@ fn probe_for_lev_candidate(&mut self) -> Result<Option<ty::AssocItem>, MethodErr
             } else {
                 let best_name = {
                     let names = applicable_close_candidates.iter().map(|cand| &cand.ident.name);
-                    find_best_match_for_name(names, &self.method_name.unwrap().as_str(), None)
+                    find_best_match_for_name(names, self.method_name.unwrap().name, None)
                 }
                 .unwrap();
                 Ok(applicable_close_candidates