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)] #[derive(Debug, Clone)]
pub(super) struct NestedGoals<'tcx> { 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>>>, pub(super) goals: Vec<Goal<'tcx, ty::Predicate<'tcx>>>,
} }
impl NestedGoals<'_> { impl NestedGoals<'_> {
pub(super) fn new() -> Self { 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 { 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 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
impl<'tcx> EvalCtxt<'_, 'tcx> { impl<'tcx> EvalCtxt<'_, 'tcx> {
#[instrument(level = "debug", skip(self))] #[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!( 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" "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))] #[instrument(level = "debug", skip(self))]
@ -438,7 +438,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|this| { |this| {
let mut has_changed = Err(Certainty::Yes); 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( let (_, certainty) = match this.evaluate_goal(
IsNormalizesToHack::Yes, IsNormalizesToHack::Yes,
goal.with(this.tcx(), ty::Binder::dummy(goal.predicate)), goal.with(this.tcx(), ty::Binder::dummy(goal.predicate)),
@ -475,7 +475,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
term, term,
projection_ty: goal.predicate.projection_ty, 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)); Some(goal.with(this.tcx(), projection_pred));
has_changed = has_changed.map_err(|c| c.unify_and(certainty)); has_changed = has_changed.map_err(|c| c.unify_and(certainty));

View file

@ -43,7 +43,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
term: unconstrained_rhs, 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.try_evaluate_added_goals()?;
self.eq(goal.param_env, unconstrained_rhs, predicate.term)?; self.eq(goal.param_env, unconstrained_rhs, predicate.term)?;
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes) self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)