rustc_next_trait_solver/solve/normalizes_to/
anon_const.rs1use rustc_type_ir::{self as ty, Interner};
2use tracing::instrument;
3
4use crate::delegate::SolverDelegate;
5use crate::solve::{Certainty, EvalCtxt, Goal, 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 normalize_anon_const(
14 &mut self,
15 goal: Goal<I, ty::NormalizesTo<I>>,
16 ) -> QueryResult<I> {
17 if let Some(normalized_const) = self.evaluate_const(
18 goal.param_env,
19 ty::UnevaluatedConst::new(
20 goal.predicate.alias.def_id.try_into().unwrap(),
21 goal.predicate.alias.args,
22 ),
23 ) {
24 self.instantiate_normalizes_to_term(goal, normalized_const.into());
25 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
26 } else {
27 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
28 }
29 }
30}