rustc_next_trait_solver/solve/
project_goals.rs
1use rustc_type_ir::{self as ty, Interner, ProjectionPredicate};
2use tracing::instrument;
3
4use crate::delegate::SolverDelegate;
5use crate::solve::{Certainty, EvalCtxt, Goal, GoalSource, QueryResult};
6
7impl<D, I> EvalCtxt<'_, D>
8where
9 D: SolverDelegate<Interner = I>,
10 I: Interner,
11{
12 #[instrument(level = "trace", skip(self), ret)]
13 pub(super) fn compute_projection_goal(
14 &mut self,
15 goal: Goal<I, ProjectionPredicate<I>>,
16 ) -> QueryResult<I> {
17 let cx = self.cx();
18 let projection_term = goal.predicate.projection_term.to_term(cx);
19 let goal = goal.with(
20 cx,
21 ty::PredicateKind::AliasRelate(
22 projection_term,
23 goal.predicate.term,
24 ty::AliasRelationDirection::Equate,
25 ),
26 );
27 self.add_goal(GoalSource::Misc, goal);
28 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
29 }
30}