Skip to content

Commit bb758cf

Browse files
committed
Auto merge of rust-lang#110674 - compiler-errors:expect-projection-term-eq-succeeds, r=BoxyUwU
Expect that equating a projection term always succeeds in new solver These should never fail. If they do, we have a problem with the logic that replaces a projection goal's term with an unconstrained infer var. Let's make sure we ICE in that case.
2 parents 4396cec + 6041030 commit bb758cf

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

compiler/rustc_trait_selection/src/solve/project_goals.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
7373
goal.predicate.projection_ty,
7474
assumption_projection_pred.projection_ty,
7575
)?;
76-
ecx.eq(goal.param_env, goal.predicate.term, assumption_projection_pred.term)?;
76+
ecx.eq(goal.param_env, goal.predicate.term, assumption_projection_pred.term)
77+
.expect("expected goal term to be fully unconstrained");
7778
ecx.add_goals(requirements);
7879
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
7980
})
@@ -114,7 +115,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
114115
.into_iter()
115116
.map(|pred| goal.with(tcx, pred)),
116117
);
117-
ecx.eq(goal.param_env, goal.predicate.term, assumption_projection_pred.term)?;
118+
ecx.eq(goal.param_env, goal.predicate.term, assumption_projection_pred.term)
119+
.expect("expected goal term to be fully unconstrained");
118120
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
119121
})
120122
} else {
@@ -206,7 +208,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
206208
ty.map_bound(|ty| ty.into())
207209
};
208210

209-
ecx.eq(goal.param_env, goal.predicate.term, term.subst(tcx, substs))?;
211+
ecx.eq(goal.param_env, goal.predicate.term, term.subst(tcx, substs))
212+
.expect("expected goal term to be fully unconstrained");
210213
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
211214
})
212215
}
@@ -375,7 +378,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
375378
),
376379
};
377380

378-
ecx.eq(goal.param_env, goal.predicate.term, metadata_ty.into())?;
381+
ecx.eq(goal.param_env, goal.predicate.term, metadata_ty.into())
382+
.expect("expected goal term to be fully unconstrained");
379383
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
380384
})
381385
}
@@ -513,7 +517,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
513517
};
514518

515519
ecx.probe(|ecx| {
516-
ecx.eq(goal.param_env, goal.predicate.term, discriminant_ty.into())?;
520+
ecx.eq(goal.param_env, goal.predicate.term, discriminant_ty.into())
521+
.expect("expected goal term to be fully unconstrained");
517522
ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
518523
})
519524
}

0 commit comments

Comments
 (0)