Finish uplifting supertraits
This commit is contained in:
parent
66eb346770
commit
15d16f1cd6
4 changed files with 3 additions and 16 deletions
|
@ -32,12 +32,6 @@ pub trait SolverDelegate:
|
||||||
// FIXME: Uplift the leak check into this crate.
|
// FIXME: Uplift the leak check into this crate.
|
||||||
fn leak_check(&self, max_input_universe: ty::UniverseIndex) -> Result<(), NoSolution>;
|
fn leak_check(&self, max_input_universe: ty::UniverseIndex) -> Result<(), NoSolution>;
|
||||||
|
|
||||||
// FIXME: This is only here because elaboration lives in `rustc_infer`!
|
|
||||||
fn elaborate_supertraits(
|
|
||||||
cx: Self::Interner,
|
|
||||||
trait_ref: ty::Binder<Self::Interner, ty::TraitRef<Self::Interner>>,
|
|
||||||
) -> impl Iterator<Item = ty::Binder<Self::Interner, ty::TraitRef<Self::Interner>>>;
|
|
||||||
|
|
||||||
fn try_const_eval_resolve(
|
fn try_const_eval_resolve(
|
||||||
&self,
|
&self,
|
||||||
param_env: <Self::Interner as Interner>::ParamEnv,
|
param_env: <Self::Interner as Interner>::ParamEnv,
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
pub(super) mod structural_traits;
|
pub(super) mod structural_traits;
|
||||||
|
|
||||||
|
use rustc_type_ir::elaborate;
|
||||||
use rustc_type_ir::fold::TypeFoldable;
|
use rustc_type_ir::fold::TypeFoldable;
|
||||||
use rustc_type_ir::inherent::*;
|
use rustc_type_ir::inherent::*;
|
||||||
use rustc_type_ir::lang_items::TraitSolverLangItem;
|
use rustc_type_ir::lang_items::TraitSolverLangItem;
|
||||||
|
@ -667,7 +668,7 @@ where
|
||||||
// a projection goal.
|
// a projection goal.
|
||||||
if let Some(principal) = bounds.principal() {
|
if let Some(principal) = bounds.principal() {
|
||||||
let principal_trait_ref = principal.with_self_ty(cx, self_ty);
|
let principal_trait_ref = principal.with_self_ty(cx, self_ty);
|
||||||
for (idx, assumption) in D::elaborate_supertraits(cx, principal_trait_ref).enumerate() {
|
for (idx, assumption) in elaborate::supertraits(cx, principal_trait_ref).enumerate() {
|
||||||
candidates.extend(G::probe_and_consider_object_bound_candidate(
|
candidates.extend(G::probe_and_consider_object_bound_candidate(
|
||||||
self,
|
self,
|
||||||
CandidateSource::BuiltinImpl(BuiltinImplSource::Object(idx)),
|
CandidateSource::BuiltinImpl(BuiltinImplSource::Object(idx)),
|
||||||
|
|
|
@ -787,7 +787,7 @@ where
|
||||||
));
|
));
|
||||||
} else if let Some(a_principal) = a_data.principal() {
|
} else if let Some(a_principal) = a_data.principal() {
|
||||||
for new_a_principal in
|
for new_a_principal in
|
||||||
D::elaborate_supertraits(self.cx(), a_principal.with_self_ty(cx, a_ty)).skip(1)
|
elaborate::supertraits(self.cx(), a_principal.with_self_ty(cx, a_ty)).skip(1)
|
||||||
{
|
{
|
||||||
responses.extend(self.consider_builtin_upcast_to_principal(
|
responses.extend(self.consider_builtin_upcast_to_principal(
|
||||||
goal,
|
goal,
|
||||||
|
|
|
@ -8,7 +8,6 @@ use rustc_infer::infer::canonical::{
|
||||||
};
|
};
|
||||||
use rustc_infer::infer::{InferCtxt, RegionVariableOrigin, TyCtxtInferExt};
|
use rustc_infer::infer::{InferCtxt, RegionVariableOrigin, TyCtxtInferExt};
|
||||||
use rustc_infer::traits::solve::Goal;
|
use rustc_infer::traits::solve::Goal;
|
||||||
use rustc_infer::traits::util::supertraits;
|
|
||||||
use rustc_infer::traits::{ObligationCause, Reveal};
|
use rustc_infer::traits::{ObligationCause, Reveal};
|
||||||
use rustc_middle::ty::fold::TypeFoldable;
|
use rustc_middle::ty::fold::TypeFoldable;
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
|
||||||
|
@ -82,13 +81,6 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
|
||||||
self.0.leak_check(max_input_universe, None).map_err(|_| NoSolution)
|
self.0.leak_check(max_input_universe, None).map_err(|_| NoSolution)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn elaborate_supertraits(
|
|
||||||
interner: TyCtxt<'tcx>,
|
|
||||||
trait_ref: ty::Binder<'tcx, ty::TraitRef<'tcx>>,
|
|
||||||
) -> impl Iterator<Item = ty::Binder<'tcx, ty::TraitRef<'tcx>>> {
|
|
||||||
supertraits(interner, trait_ref)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn try_const_eval_resolve(
|
fn try_const_eval_resolve(
|
||||||
&self,
|
&self,
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue