Skip to content

Commit 17705ea

Browse files
committed
add comment
1 parent 4a38442 commit 17705ea

File tree

1 file changed

+14
-0
lines changed
  • compiler/rustc_trait_selection/src/solve/eval_ctxt

1 file changed

+14
-0
lines changed

compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,20 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
395395
original_values: Vec<ty::GenericArg<'tcx>>,
396396
response: CanonicalResponse<'tcx>,
397397
) -> Result<(Certainty, bool, Vec<Goal<'tcx, ty::Predicate<'tcx>>>), NoSolution> {
398+
// The old solver did not evaluate nested goals when normalizing.
399+
// It returned the selection constraints allowing a `Projection`
400+
// obligation to not hold in coherence while avoiding the fatal error
401+
// from overflow.
402+
//
403+
// We match this behavior here by considering all constraints
404+
// from nested goals which are not from where-bounds. We will already
405+
// need to track which nested goals are required by impl where-bounds
406+
// for coinductive cycles, so we simply reuse that here.
407+
//
408+
// While we could consider overflow constraints in more cases, this should
409+
// not be necessary for backcompat and results in better perf. It also
410+
// avoids a potential inconsistency which would otherwise require some
411+
// tracking for root goals as well. See #119071 for an example.
398412
let keep_overflow_constraints = || {
399413
self.search_graph.current_goal_is_normalizes_to()
400414
&& source != GoalSource::ImplWhereBound

0 commit comments

Comments
 (0)