]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_ty/ty.rs
introduce PredicateAtom
[rust.git] / src / librustc_ty / ty.rs
index c99bc8a47e33b45524d1d55b51ab22e0fea0bc2d..7f954dacf3e893c4a3b96bf9a9d0c2ad6c74fce0 100644 (file)
@@ -392,23 +392,23 @@ fn associated_type_projection_predicates(
 
     let predicates = item_predicates.filter_map(|obligation| {
         let pred = obligation.predicate;
-        match pred.kind() {
-            ty::PredicateKind::Trait(tr, _) => {
-                if let ty::Projection(p) = tr.skip_binder().self_ty().kind {
+        match pred.skip_binders() {
+            ty::PredicateAtom::Trait(tr, _) => {
+                if let ty::Projection(p) = tr.self_ty().kind {
                     if p == assoc_item_ty {
                         return Some(pred);
                     }
                 }
             }
-            ty::PredicateKind::Projection(proj) => {
-                if let ty::Projection(p) = proj.skip_binder().projection_ty.self_ty().kind {
+            ty::PredicateAtom::Projection(proj) => {
+                if let ty::Projection(p) = proj.projection_ty.self_ty().kind {
                     if p == assoc_item_ty {
                         return Some(pred);
                     }
                 }
             }
-            ty::PredicateKind::TypeOutlives(outlives) => {
-                if let ty::Projection(p) = outlives.skip_binder().0.kind {
+            ty::PredicateAtom::TypeOutlives(outlives) => {
+                if let ty::Projection(p) = outlives.0.kind {
                     if p == assoc_item_ty {
                         return Some(pred);
                     }
@@ -443,25 +443,24 @@ fn opaque_type_projection_predicates(
 
     let filtered_predicates = predicates.filter_map(|obligation| {
         let pred = obligation.predicate;
-        match pred.kind() {
-            ty::PredicateKind::Trait(tr, _) => {
-                if let ty::Opaque(opaque_def_id, opaque_substs) = tr.skip_binder().self_ty().kind {
+        match pred.skip_binders() {
+            ty::PredicateAtom::Trait(tr, _) => {
+                if let ty::Opaque(opaque_def_id, opaque_substs) = tr.self_ty().kind {
                     if opaque_def_id == def_id && opaque_substs == substs {
                         return Some(pred);
                     }
                 }
             }
-            ty::PredicateKind::Projection(proj) => {
-                if let ty::Opaque(opaque_def_id, opaque_substs) =
-                    proj.skip_binder().projection_ty.self_ty().kind
+            ty::PredicateAtom::Projection(proj) => {
+                if let ty::Opaque(opaque_def_id, opaque_substs) = proj.projection_ty.self_ty().kind
                 {
                     if opaque_def_id == def_id && opaque_substs == substs {
                         return Some(pred);
                     }
                 }
             }
-            ty::PredicateKind::TypeOutlives(outlives) => {
-                if let ty::Opaque(opaque_def_id, opaque_substs) = outlives.skip_binder().0.kind {
+            ty::PredicateAtom::TypeOutlives(outlives) => {
+                if let ty::Opaque(opaque_def_id, opaque_substs) = outlives.0.kind {
                     if opaque_def_id == def_id && opaque_substs == substs {
                         return Some(pred);
                     }
@@ -471,7 +470,7 @@ fn opaque_type_projection_predicates(
                 }
             }
             // These can come from elaborating other predicates
-            ty::PredicateKind::RegionOutlives(_) => return None,
+            ty::PredicateAtom::RegionOutlives(_) => return None,
             _ => {}
         }
         tcx.sess.delay_span_bug(