about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2023-12-19 17:39:48 +0100
committerlcnr <rust@lcnr.de>2023-12-19 17:39:48 +0100
commit17705ea0a85237969d29f63a3d828d6fbaba8e2f (patch)
tree6589a294c1347aa3867784bf128384411bd62e00
parent4a38442c900bd859ecece400454d5abc56647b64 (diff)
downloadrust-17705ea0a85237969d29f63a3d828d6fbaba8e2f.tar.gz
rust-17705ea0a85237969d29f63a3d828d6fbaba8e2f.zip
add comment
-rw-r--r--compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
index ee0fc8139a2..76c50a11102 100644
--- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
+++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
@@ -395,6 +395,20 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
         original_values: Vec<ty::GenericArg<'tcx>>,
         response: CanonicalResponse<'tcx>,
     ) -> Result<(Certainty, bool, Vec<Goal<'tcx, ty::Predicate<'tcx>>>), NoSolution> {
+        // The old solver did not evaluate nested goals when normalizing.
+        // It returned the selection constraints allowing a `Projection`
+        // obligation to not hold in coherence while avoiding the fatal error
+        // from overflow.
+        //
+        // We match this behavior here by considering all constraints
+        // from nested goals which are not from where-bounds. We will already
+        // need to track which nested goals are required by impl where-bounds
+        // for coinductive cycles, so we simply reuse that here.
+        //
+        // While we could consider overflow constraints in more cases, this should
+        // not be necessary for backcompat and results in better perf. It also
+        // avoids a potential inconsistency which would otherwise require some
+        // tracking for root goals as well. See #119071 for an example.
         let keep_overflow_constraints = || {
             self.search_graph.current_goal_is_normalizes_to()
                 && source != GoalSource::ImplWhereBound