]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/impl_wf_check/min_specialization.rs
Rollup merge of #75485 - RalfJung:pin, r=nagisa
[rust.git] / src / librustc_typeck / impl_wf_check / min_specialization.rs
index e4bffedd620b99e2110a533acfb29ba528515a0c..3746e5778aacdb740694fc3adf08952e710cff8e 100644 (file)
@@ -198,9 +198,9 @@ fn unconstrained_parent_impl_substs<'tcx>(
     // the functions in `cgp` add the constrained parameters to a list of
     // unconstrained parameters.
     for (predicate, _) in impl_generic_predicates.predicates.iter() {
-        if let ty::PredicateKind::Projection(proj) = predicate.kind() {
-            let projection_ty = proj.skip_binder().projection_ty;
-            let projected_ty = proj.skip_binder().ty;
+        if let ty::PredicateAtom::Projection(proj) = predicate.skip_binders() {
+            let projection_ty = proj.projection_ty;
+            let projected_ty = proj.ty;
 
             let unbound_trait_ref = projection_ty.trait_ref(tcx);
             if Some(unbound_trait_ref) == impl_trait_ref {
@@ -336,7 +336,7 @@ fn check_predicates<'tcx>(
         if let Some(obligations) = wf::obligations(
             infcx,
             tcx.param_env(impl1_def_id),
-            tcx.hir().as_local_hir_id(impl1_def_id),
+            tcx.hir().local_def_id_to_hir_id(impl1_def_id),
             arg,
             span,
         ) {
@@ -359,13 +359,13 @@ fn check_predicates<'tcx>(
 
 fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tcx>, span: Span) {
     debug!("can_specialize_on(predicate = {:?})", predicate);
-    match predicate.kind() {
+    match predicate.skip_binders() {
         // Global predicates are either always true or always false, so we
         // are fine to specialize on.
         _ if predicate.is_global() => (),
         // We allow specializing on explicitly marked traits with no associated
         // items.
-        ty::PredicateKind::Trait(pred, hir::Constness::NotConst) => {
+        ty::PredicateAtom::Trait(pred, hir::Constness::NotConst) => {
             if !matches!(
                 trait_predicate_kind(tcx, predicate),
                 Some(TraitSpecializationKind::Marker)
@@ -392,19 +392,19 @@ fn trait_predicate_kind<'tcx>(
     tcx: TyCtxt<'tcx>,
     predicate: ty::Predicate<'tcx>,
 ) -> Option<TraitSpecializationKind> {
-    match predicate.kind() {
-        ty::PredicateKind::Trait(pred, hir::Constness::NotConst) => {
+    match predicate.skip_binders() {
+        ty::PredicateAtom::Trait(pred, hir::Constness::NotConst) => {
             Some(tcx.trait_def(pred.def_id()).specialization_kind)
         }
-        ty::PredicateKind::Trait(_, hir::Constness::Const)
-        | ty::PredicateKind::RegionOutlives(_)
-        | ty::PredicateKind::TypeOutlives(_)
-        | ty::PredicateKind::Projection(_)
-        | ty::PredicateKind::WellFormed(_)
-        | ty::PredicateKind::Subtype(_)
-        | ty::PredicateKind::ObjectSafe(_)
-        | ty::PredicateKind::ClosureKind(..)
-        | ty::PredicateKind::ConstEvaluatable(..)
-        | ty::PredicateKind::ConstEquate(..) => None,
+        ty::PredicateAtom::Trait(_, hir::Constness::Const)
+        | ty::PredicateAtom::RegionOutlives(_)
+        | ty::PredicateAtom::TypeOutlives(_)
+        | ty::PredicateAtom::Projection(_)
+        | ty::PredicateAtom::WellFormed(_)
+        | ty::PredicateAtom::Subtype(_)
+        | ty::PredicateAtom::ObjectSafe(_)
+        | ty::PredicateAtom::ClosureKind(..)
+        | ty::PredicateAtom::ConstEvaluatable(..)
+        | ty::PredicateAtom::ConstEquate(..) => None,
     }
 }