UNACEPTABLE

This commit is contained in:
Boxy 2023-03-17 14:04:39 +00:00
parent ce14a1eba0
commit e06c62cd5b
3 changed files with 9 additions and 9 deletions

View File

@ -43,17 +43,17 @@ pub(super) enum IsNormalizesToHack {
#[derive(Debug, Clone)]
pub(super) struct NestedGoals<'tcx> {
pub(super) projection_eq_hack_goal: Option<Goal<'tcx, ty::ProjectionPredicate<'tcx>>>,
pub(super) normalizes_to_hack_goal: Option<Goal<'tcx, ty::ProjectionPredicate<'tcx>>>,
pub(super) goals: Vec<Goal<'tcx, ty::Predicate<'tcx>>>,
}
impl NestedGoals<'_> {
pub(super) fn new() -> Self {
Self { projection_eq_hack_goal: None, goals: Vec::new() }
Self { normalizes_to_hack_goal: None, goals: Vec::new() }
}
pub(super) fn is_empty(&self) -> bool {
self.projection_eq_hack_goal.is_none() && self.goals.is_empty()
self.normalizes_to_hack_goal.is_none() && self.goals.is_empty()
}
}

View File

@ -406,12 +406,12 @@ fn compute_const_arg_has_type_goal(
impl<'tcx> EvalCtxt<'_, 'tcx> {
#[instrument(level = "debug", skip(self))]
fn set_projection_eq_hack_goal(&mut self, goal: Goal<'tcx, ty::ProjectionPredicate<'tcx>>) {
fn set_normalizes_to_hack_goal(&mut self, goal: Goal<'tcx, ty::ProjectionPredicate<'tcx>>) {
assert!(
self.nested_goals.projection_eq_hack_goal.is_none(),
self.nested_goals.normalizes_to_hack_goal.is_none(),
"attempted to set the projection eq hack goal when one already exists"
);
self.nested_goals.projection_eq_hack_goal = Some(goal);
self.nested_goals.normalizes_to_hack_goal = Some(goal);
}
#[instrument(level = "debug", skip(self))]
@ -438,7 +438,7 @@ fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolution> {
|this| {
let mut has_changed = Err(Certainty::Yes);
if let Some(goal) = goals.projection_eq_hack_goal.take() {
if let Some(goal) = goals.normalizes_to_hack_goal.take() {
let (_, certainty) = match this.evaluate_goal(
IsNormalizesToHack::Yes,
goal.with(this.tcx(), ty::Binder::dummy(goal.predicate)),
@ -475,7 +475,7 @@ fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolution> {
term,
projection_ty: goal.predicate.projection_ty,
};
new_goals.projection_eq_hack_goal =
new_goals.normalizes_to_hack_goal =
Some(goal.with(this.tcx(), projection_pred));
has_changed = has_changed.map_err(|c| c.unify_and(certainty));

View File

@ -43,7 +43,7 @@ pub(super) fn compute_projection_goal(
term: unconstrained_rhs,
};
self.set_projection_eq_hack_goal(goal.with(self.tcx(), unconstrained_predicate));
self.set_normalizes_to_hack_goal(goal.with(self.tcx(), unconstrained_predicate));
self.try_evaluate_added_goals()?;
self.eq(goal.param_env, unconstrained_rhs, predicate.term)?;
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)