]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/impl_wf_check/min_specialization.rs
introduce PredicateAtom
[rust.git] / src / librustc_typeck / impl_wf_check / min_specialization.rs
index c1c8e73358bca4f819539fdbcd9cf926a6f71ea7..8257c6ce92547b8d51378a9797845c1a6b8a3385 100644 (file)
@@ -163,7 +163,7 @@ fn get_impl_substs<'tcx>(
     let impl2_substs = translate_substs(infcx, param_env, impl1_def_id, impl1_substs, impl2_node);
 
     // Conservatively use an empty `ParamEnv`.
-    let outlives_env = OutlivesEnvironment::new(tcx, ty::ParamEnv::empty());
+    let outlives_env = OutlivesEnvironment::new(ty::ParamEnv::empty());
     infcx.resolve_regions_and_report_errors(impl1_def_id, &outlives_env, RegionckMode::default());
     let impl2_substs = match infcx.fully_resolve(&impl2_substs) {
         Ok(s) => s,
@@ -198,9 +198,7 @@ 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.ignore_qualifiers(tcx).skip_binder().kind()
-        {
+        if let ty::PredicateAtom::Projection(proj) = predicate.skip_binders() {
             let projection_ty = proj.projection_ty;
             let projected_ty = proj.ty;
 
@@ -361,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.ignore_qualifiers(tcx).skip_binder().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)
@@ -394,20 +392,19 @@ fn trait_predicate_kind<'tcx>(
     tcx: TyCtxt<'tcx>,
     predicate: ty::Predicate<'tcx>,
 ) -> Option<TraitSpecializationKind> {
-    match predicate.ignore_qualifiers(tcx).skip_binder().kind() {
-        ty::PredicateKind::ForAll(_) => bug!("unexpected predicate: {:?}", predicate),
-        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,
     }
 }