Struct rustc_trait_selection::solve::EvalCtxt
source · struct EvalCtxt<'a, 'tcx> {
infcx: &'a InferCtxt<'tcx>,
var_values: CanonicalVarValues<'tcx>,
search_graph: &'a mut SearchGraph<'tcx>,
}Fields§
§infcx: &'a InferCtxt<'tcx>§var_values: CanonicalVarValues<'tcx>§search_graph: &'a mut SearchGraph<'tcx>Implementations§
source§impl<'tcx> EvalCtxt<'_, 'tcx>
impl<'tcx> EvalCtxt<'_, 'tcx>
pub(super) fn assemble_and_evaluate_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>
) -> Vec<Candidate<'tcx>>
sourcefn assemble_candidates_after_normalizing_self_ty<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
fn assemble_candidates_after_normalizing_self_ty<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
If the self type of a goal is a projection, computing the relevant candidates is difficult.
To deal with this, we first try to normalize the self type and add the candidates for the normalized self type to the list of candidates in case that succeeds. Note that we can’t just eagerly return in this case as projections as self types add `
fn assemble_impl_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
fn assemble_builtin_impl_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
fn assemble_param_env_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
fn assemble_alias_bound_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
fn assemble_object_bound_candidates<G: GoalKind<'tcx>>(
&mut self,
goal: Goal<'tcx, G>,
candidates: &mut Vec<Candidate<'tcx>>
)
source§impl<'tcx> EvalCtxt<'_, 'tcx>
impl<'tcx> EvalCtxt<'_, 'tcx>
pub(super) fn compute_projection_goal(
&mut self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>
) -> QueryResult<'tcx>
sourcefn term_is_fully_unconstrained(
&self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>
) -> bool
fn term_is_fully_unconstrained(
&self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>
) -> bool
Is the projection predicate is of the form exists<T> <Ty as Trait>::Assoc = T.
This is the case if the term is an inference variable in the innermost universe
and does not occur in any other part of the predicate.
fn merge_project_candidates(
&mut self,
candidates: Vec<Candidate<'tcx>>
) -> QueryResult<'tcx>
fn project_candidate_should_be_dropped_in_favor_of(
&self,
candidate: &Candidate<'tcx>,
other: &Candidate<'tcx>
) -> bool
source§impl<'tcx> EvalCtxt<'_, 'tcx>
impl<'tcx> EvalCtxt<'_, 'tcx>
sourcepub fn repeat_while_none(
&mut self,
loop_body: impl FnMut(&mut Self) -> Option<Result<Certainty, NoSolution>>
) -> Result<Certainty, NoSolution>
pub fn repeat_while_none(
&mut self,
loop_body: impl FnMut(&mut Self) -> Option<Result<Certainty, NoSolution>>
) -> Result<Certainty, NoSolution>
A while-loop which tracks overflow.
source§impl<'tcx> EvalCtxt<'_, 'tcx>
impl<'tcx> EvalCtxt<'_, 'tcx>
sourcefn probe_and_evaluate_goal_for_constituent_tys(
&mut self,
goal: Goal<'tcx, TraitPredicate<'tcx>>,
constituent_tys: impl Fn(&InferCtxt<'tcx>, Ty<'tcx>) -> Result<Vec<Ty<'tcx>>, NoSolution>
) -> QueryResult<'tcx>
fn probe_and_evaluate_goal_for_constituent_tys(
&mut self,
goal: Goal<'tcx, TraitPredicate<'tcx>>,
constituent_tys: impl Fn(&InferCtxt<'tcx>, Ty<'tcx>) -> Result<Vec<Ty<'tcx>>, NoSolution>
) -> QueryResult<'tcx>
Convenience function for traits that are structural, i.e. that only have nested subgoals that only change the self type. Unlike other evaluate-like helpers, this does a probe, so it doesn’t need to be wrapped in one.
pub(super) fn compute_trait_goal(
&mut self,
goal: Goal<'tcx, TraitPredicate<'tcx>>
) -> QueryResult<'tcx>
pub(super) fn merge_trait_candidates_discard_reservation_impls(
&mut self,
candidates: Vec<Candidate<'tcx>>
) -> QueryResult<'tcx>
fn trait_candidate_should_be_dropped_in_favor_of(
&self,
candidate: &Candidate<'tcx>,
other: &Candidate<'tcx>
) -> bool
fn discard_reservation_impl(&self, candidate: Candidate<'tcx>) -> Candidate<'tcx>
source§impl<'a, 'tcx> EvalCtxt<'a, 'tcx>
impl<'a, 'tcx> EvalCtxt<'a, 'tcx>
fn tcx(&self) -> TyCtxt<'tcx>
sourcefn new_outside_solver(
infcx: &'a InferCtxt<'tcx>,
search_graph: &'a mut SearchGraph<'tcx>
) -> EvalCtxt<'a, 'tcx>
fn new_outside_solver(
infcx: &'a InferCtxt<'tcx>,
search_graph: &'a mut SearchGraph<'tcx>
) -> EvalCtxt<'a, 'tcx>
Creates a new evaluation context outside of the trait solver.
With this solver making a canonical response doesn’t make much sense.
The search_graph for this solver has to be completely empty.
fn evaluate_canonical_goal(
tcx: TyCtxt<'tcx>,
search_graph: &'a mut SearchGraph<'tcx>,
canonical_goal: Canonical<'tcx, Goal<'tcx, Predicate<'tcx>>>
) -> QueryResult<'tcx>
fn make_canonical_response(&self, certainty: Certainty) -> QueryResult<'tcx>
sourcefn evaluate_goal(
&mut self,
goal: Goal<'tcx, Predicate<'tcx>>
) -> Result<(bool, Certainty), NoSolution>
fn evaluate_goal(
&mut self,
goal: Goal<'tcx, Predicate<'tcx>>
) -> Result<(bool, Certainty), NoSolution>
Recursively evaluates goal, returning whether any inference vars have
been constrained and the certainty of the result.
fn compute_goal(
&mut self,
goal: Goal<'tcx, Predicate<'tcx>>
) -> QueryResult<'tcx>
fn compute_type_outlives_goal(
&mut self,
_goal: Goal<'tcx, TypeOutlivesPredicate<'tcx>>
) -> QueryResult<'tcx>
fn compute_region_outlives_goal(
&mut self,
_goal: Goal<'tcx, RegionOutlivesPredicate<'tcx>>
) -> QueryResult<'tcx>
source§impl<'tcx> EvalCtxt<'_, 'tcx>
impl<'tcx> EvalCtxt<'_, 'tcx>
fn evaluate_all(
&mut self,
goals: Vec<Goal<'tcx, Predicate<'tcx>>>
) -> Result<Certainty, NoSolution>
fn evaluate_all_and_make_canonical_response(
&mut self,
goals: Vec<Goal<'tcx, Predicate<'tcx>>>
) -> QueryResult<'tcx>
Auto Trait Implementations§
impl<'a, 'tcx> !RefUnwindSafe for EvalCtxt<'a, 'tcx>
impl<'a, 'tcx> !Send for EvalCtxt<'a, 'tcx>
impl<'a, 'tcx> !Sync for EvalCtxt<'a, 'tcx>
impl<'a, 'tcx> Unpin for EvalCtxt<'a, 'tcx>where
'tcx: 'a,
impl<'a, 'tcx> !UnwindSafe for EvalCtxt<'a, 'tcx>
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes