Files
rust/compiler/rustc_next_trait_solver/src/solve/project_goals.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
952 B
Rust
Raw Normal View History

2024-06-17 17:59:08 -04:00
use rustc_type_ir::{self as ty, Interner, ProjectionPredicate};
2024-06-17 19:12:23 -04:00
use tracing::instrument;
2023-12-18 07:49:46 +01:00
2024-06-18 19:13:54 -04:00
use crate::delegate::SolverDelegate;
2024-06-17 17:59:08 -04:00
use crate::solve::{Certainty, EvalCtxt, Goal, GoalSource, QueryResult};
2023-12-07 18:20:27 +01:00
2024-06-18 19:13:54 -04:00
impl<D, I> EvalCtxt<'_, D>
2024-06-17 17:59:08 -04:00
where
2024-06-18 19:13:54 -04:00
D: SolverDelegate<Interner = I>,
2024-06-17 17:59:08 -04:00
I: Interner,
{
#[instrument(level = "trace", skip(self), ret)]
2023-12-07 18:20:27 +01:00
pub(super) fn compute_projection_goal(
&mut self,
2024-06-17 17:59:08 -04:00
goal: Goal<I, ProjectionPredicate<I>>,
) -> QueryResult<I> {
2024-06-18 19:13:54 -04:00
let tcx = self.cx();
2024-05-13 10:00:38 -04:00
let projection_term = goal.predicate.projection_term.to_term(tcx);
2023-12-18 07:49:46 +01:00
let goal = goal.with(
tcx,
ty::PredicateKind::AliasRelate(
projection_term,
goal.predicate.term,
ty::AliasRelationDirection::Equate,
),
2023-12-18 07:49:46 +01:00
);
self.add_goal(GoalSource::Misc, goal);
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
2023-12-07 18:20:27 +01:00
}
}