]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/type_check/mod.rs
introduce PredicateAtom
[rust.git] / src / librustc_mir / borrow_check / type_check / mod.rs
index 7b84737fa77a46689f4a6bfea3e66ed723a3dcb3..bc5c144cd742c42fb81df884d39f33f1896f97cf 100644 (file)
@@ -27,8 +27,8 @@
 use rustc_middle::ty::fold::TypeFoldable;
 use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
 use rustc_middle::ty::{
-    self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef,
-    ToPredicate, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
+    self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPredicate, Ty,
+    TyCtxt, UserType, UserTypeAnnotationIndex, WithConstness,
 };
 use rustc_span::{Span, DUMMY_SP};
 use rustc_target::abi::VariantIdx;
@@ -1021,7 +1021,7 @@ fn check_user_type_annotations(&mut self) {
                     }
 
                     self.prove_predicate(
-                        ty::PredicateKind::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
+                        ty::PredicateAtom::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
                         Locations::All(span),
                         ConstraintCategory::TypeAnnotation,
                     );
@@ -1239,7 +1239,7 @@ fn eq_opaque_type_and_type(
         let tcx = infcx.tcx;
         let param_env = self.param_env;
         let body = self.body;
-        let concrete_opaque_types = &tcx.typeck_tables_of(anon_owner_def_id).concrete_opaque_types;
+        let concrete_opaque_types = &tcx.typeck(anon_owner_def_id).concrete_opaque_types;
         let mut opaque_type_values = Vec::new();
 
         debug!("eq_opaque_type_and_type: mir_def_id={:?}", self.mir_def_id);
@@ -1273,7 +1273,7 @@ fn eq_opaque_type_and_type(
                     obligations.obligations.push(traits::Obligation::new(
                         ObligationCause::dummy(),
                         param_env,
-                        ty::PredicateKind::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
+                        ty::PredicateAtom::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
                     ));
                     obligations.add(
                         infcx
@@ -1617,7 +1617,7 @@ fn check_terminator(
                 self.check_call_dest(body, term, &sig, destination, term_location);
 
                 self.prove_predicates(
-                    sig.inputs_and_output.iter().map(|ty| ty::PredicateKind::WellFormed(ty.into())),
+                    sig.inputs_and_output.iter().map(|ty| ty::PredicateAtom::WellFormed(ty.into())),
                     term_location.to_locations(),
                     ConstraintCategory::Boring,
                 );
@@ -2022,18 +2022,14 @@ fn check_rvalue(&mut self, body: &Body<'tcx>, rvalue: &Rvalue<'tcx>, location: L
                                         traits::ObligationCauseCode::RepeatVec(should_suggest),
                                     ),
                                     self.param_env,
-                                    ty::PredicateKind::Trait(
-                                        ty::Binder::bind(ty::TraitPredicate {
-                                            trait_ref: ty::TraitRef::new(
-                                                self.tcx().require_lang_item(
-                                                    CopyTraitLangItem,
-                                                    Some(self.last_span),
-                                                ),
-                                                tcx.mk_substs_trait(ty, &[]),
-                                            ),
-                                        }),
-                                        hir::Constness::NotConst,
-                                    )
+                                    ty::Binder::bind(ty::TraitRef::new(
+                                        self.tcx().require_lang_item(
+                                            CopyTraitLangItem,
+                                            Some(self.last_span),
+                                        ),
+                                        tcx.mk_substs_trait(ty, &[]),
+                                    ))
+                                    .without_const()
                                     .to_predicate(self.tcx()),
                                 ),
                                 &traits::SelectionError::Unimplemented,
@@ -2706,8 +2702,8 @@ fn prove_trait_ref(
         category: ConstraintCategory,
     ) {
         self.prove_predicates(
-            Some(ty::PredicateKind::Trait(
-                trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
+            Some(ty::PredicateAtom::Trait(
+                ty::TraitPredicate { trait_ref },
                 hir::Constness::NotConst,
             )),
             locations,