From fbdef58414af2b3469bf4f0f83bb136945414b96 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 22 Jun 2023 18:17:13 +0000 Subject: Migrate predicates_of and caller_bounds to Clause --- compiler/rustc_ty_utils/src/ty.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'compiler/rustc_ty_utils/src') diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index fe2d1fba7fe..44a253b6539 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -4,8 +4,8 @@ use rustc_hir::def::DefKind; use rustc_index::bit_set::BitSet; use rustc_middle::query::Providers; use rustc_middle::ty::{ - self, Binder, EarlyBinder, ImplTraitInTraitData, Predicate, PredicateKind, ToPredicate, Ty, - TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, + self, EarlyBinder, ImplTraitInTraitData, ToPredicate, Ty, TyCtxt, TypeSuperVisitable, + TypeVisitable, TypeVisitor, }; use rustc_session::config::TraitSolver; use rustc_span::def_id::{DefId, LocalDefId, CRATE_DEF_ID}; @@ -245,7 +245,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { }; let unnormalized_env = - ty::ParamEnv::new(tcx.mk_predicates(&predicates), traits::Reveal::UserFacing, constness); + ty::ParamEnv::new(tcx.mk_clauses(&predicates), traits::Reveal::UserFacing, constness); let body_id = local_did.unwrap_or(CRATE_DEF_ID); let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id); @@ -258,7 +258,7 @@ fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { /// its corresponding opaque within the body of a default-body trait method. struct ImplTraitInTraitFinder<'a, 'tcx> { tcx: TyCtxt<'tcx>, - predicates: &'a mut Vec>, + predicates: &'a mut Vec>, fn_def_id: DefId, bound_vars: &'tcx ty::List, seen: FxHashSet, @@ -340,9 +340,8 @@ impl<'tcx> TypeVisitor> for ImplTraitInTraitFinder<'_, 'tcx> { /// that are assumed to be well-formed (because they come from the environment). /// /// Used only in chalk mode. -fn well_formed_types_in_env(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List> { +fn well_formed_types_in_env(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List> { use rustc_hir::{ForeignItemKind, ImplItemKind, ItemKind, Node, TraitItemKind}; - use rustc_middle::ty::subst::GenericArgKind; debug!("environment(def_id = {:?})", def_id); @@ -428,8 +427,9 @@ fn well_formed_types_in_env(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List (), } - let input_clauses = inputs.into_iter().filter_map(|arg| { - match arg.unpack() { + let input_clauses = inputs.into_iter().filter_map(|_arg| { + // TODO: FIXME + /*match arg.unpack() { GenericArgKind::Type(ty) => { let binder = Binder::dummy(PredicateKind::TypeWellFormedFromEnv(ty)); Some(tcx.mk_predicate(binder)) @@ -440,10 +440,11 @@ fn well_formed_types_in_env(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::List None, - } + }*/ + None }); - tcx.mk_predicates_from_iter(clauses.chain(input_clauses)) + tcx.mk_clauses_from_iter(clauses.chain(input_clauses)) } fn param_env_reveal_all_normalized(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { -- cgit 1.4.1-3-g733a5