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

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

28 lines
929 B
Rust
Raw Normal View History

2023-12-18 07:49:46 +01:00
use crate::solve::GoalSource;
2024-06-17 11:58:38 -04:00
use super::infcx::SolverDelegate;
2023-12-07 18:20:27 +01:00
use super::EvalCtxt;
use rustc_middle::traits::solve::{Certainty, Goal, QueryResult};
use rustc_middle::ty::{self, ProjectionPredicate};
2024-06-17 11:58:38 -04:00
impl<'tcx> EvalCtxt<'_, SolverDelegate<'tcx>> {
#[instrument(level = "trace", skip(self), ret)]
2023-12-07 18:20:27 +01:00
pub(super) fn compute_projection_goal(
&mut self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>,
) -> QueryResult<'tcx> {
let tcx = self.interner();
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
}
}