Uplift Goal to rustc_type_ir

This commit is contained in:
Michael Goulet 2024-05-15 21:57:41 -04:00
parent 2684655602
commit 138881b315
22 changed files with 130 additions and 109 deletions

View file

@ -6,8 +6,9 @@ use rustc_hir::{def_id::DefId, Movability, Mutability};
use rustc_infer::traits::query::NoSolution;
use rustc_macros::{TypeFoldable, TypeVisitable};
use rustc_middle::bug;
use rustc_middle::traits::solve::Goal;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, Upcast};
use rustc_middle::ty::{
self, Goal, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, Upcast,
};
use rustc_span::sym;
use crate::solve::EvalCtxt;

View file

@ -20,11 +20,11 @@ use rustc_macros::extension;
use rustc_middle::bug;
use rustc_middle::infer::canonical::CanonicalVarInfos;
use rustc_middle::traits::solve::{
CanonicalResponse, Certainty, ExternalConstraintsData, Goal, GoalSource, QueryResult, Response,
CanonicalResponse, Certainty, ExternalConstraintsData, GoalSource, QueryResult, Response,
};
use rustc_middle::ty::{self, AliasRelationDirection, Ty, TyCtxt, UniverseIndex};
use rustc_middle::ty::{
CoercePredicate, RegionOutlivesPredicate, SubtypePredicate, TypeOutlivesPredicate,
self, AliasRelationDirection, CoercePredicate, Goal, RegionOutlivesPredicate, SubtypePredicate,
Ty, TyCtxt, TypeOutlivesPredicate, UniverseIndex,
};
mod alias_relate;

View file

@ -2703,7 +2703,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
obligated_types: &mut Vec<Ty<'tcx>>,
seen_requirements: &mut FxHashSet<DefId>,
) where
T: Upcast<'tcx, ty::Predicate<'tcx>>,
T: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>,
{
let mut long_ty_file = None;

View file

@ -302,7 +302,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
suggest_increasing_limit: bool,
) -> !
where
T: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
T: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>> + Clone,
{
let predicate = obligation.predicate.clone().upcast(self.tcx);
let predicate = self.resolve_vars_if_possible(predicate);

View file

@ -142,7 +142,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'tcx>(
fn pred_known_to_hold_modulo_regions<'tcx>(
infcx: &InferCtxt<'tcx>,
param_env: ty::ParamEnv<'tcx>,
pred: impl Upcast<'tcx, ty::Predicate<'tcx>>,
pred: impl Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>>,
) -> bool {
let obligation = Obligation::new(infcx.tcx, ObligationCause::dummy(), param_env, pred);

View file

@ -1378,7 +1378,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
error_obligation: &Obligation<'tcx, T>,
) -> Result<(), OverflowError>
where
T: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
T: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>> + Clone,
{
if !self.infcx.tcx.recursion_limit().value_within_limit(depth) {
match self.query_mode {
@ -1407,7 +1407,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
error_obligation: &Obligation<'tcx, V>,
) -> Result<(), OverflowError>
where
V: Upcast<'tcx, ty::Predicate<'tcx>> + Clone,
V: Upcast<TyCtxt<'tcx>, ty::Predicate<'tcx>> + Clone,
{
self.check_recursion_depth(obligation.recursion_depth, error_obligation)
}