]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/method/suggest.rs
introduce PredicateAtom
[rust.git] / src / librustc_typeck / check / method / suggest.rs
index 34abbb9cef11126c5d391391d20df2494df6b3bc..07cc8332b84cfebb2ccf8bd972d735427324bf5d 100644 (file)
@@ -576,10 +576,9 @@ macro_rules! report_function {
                         // this is kind of ugly.
                         |self_ty: Ty<'tcx>, parent_pred: &ty::Predicate<'tcx>, obligation: &str| {
                             // We don't care about regions here, so it's fine to skip the binder here.
-                            if let (ty::Param(_), ty::PredicateKind::Trait(p, _)) = (
-                                &self_ty.kind,
-                                parent_pred.ignore_qualifiers(tcx).skip_binder().kind(),
-                            ) {
+                            if let (ty::Param(_), ty::PredicateAtom::Trait(p, _)) =
+                                (&self_ty.kind, parent_pred.skip_binders())
+                            {
                                 if let ty::Adt(def, _) = p.trait_ref.self_ty().kind {
                                     let node = def.did.as_local().map(|def_id| {
                                         self.tcx.hir().get(self.tcx.hir().as_local_hir_id(def_id))
@@ -631,9 +630,8 @@ macro_rules! report_function {
                         }
                     };
                     let mut format_pred = |pred: ty::Predicate<'tcx>| {
-                        // TODO: forall
-                        match pred.ignore_qualifiers(tcx).skip_binder().kind() {
-                            &ty::PredicateKind::Projection(pred) => {
+                        match pred.skip_binders() {
+                            ty::PredicateAtom::Projection(pred) => {
                                 let pred = ty::Binder::bind(pred);
                                 // `<Foo as Iterator>::Item = String`.
                                 let trait_ref =
@@ -652,7 +650,7 @@ macro_rules! report_function {
                                 bound_span_label(trait_ref.self_ty(), &obligation, &quiet);
                                 Some((obligation, trait_ref.self_ty()))
                             }
-                            &ty::PredicateKind::Trait(poly_trait_ref, _) => {
+                            ty::PredicateAtom::Trait(poly_trait_ref, _) => {
                                 let poly_trait_ref = ty::Binder::bind(poly_trait_ref);
                                 let p = poly_trait_ref.skip_binder().trait_ref;
                                 let self_ty = p.self_ty();
@@ -960,11 +958,11 @@ fn suggest_traits_to_import<'b>(
                 // implementing a trait would be legal but is rejected
                 // here).
                 unsatisfied_predicates.iter().all(|(p, _)| {
-                    match p.ignore_qualifiers(self.tcx).skip_binder().kind() {
+                    match p.skip_binders() {
                         // Hide traits if they are present in predicates as they can be fixed without
                         // having to implement them.
-                        ty::PredicateKind::Trait(t, _) => t.def_id() == info.def_id,
-                        ty::PredicateKind::Projection(p) => {
+                        ty::PredicateAtom::Trait(t, _) => t.def_id() == info.def_id,
+                        ty::PredicateAtom::Projection(p) => {
                             p.projection_ty.item_def_id == info.def_id
                         }
                         _ => false,