Fix PostBorrowckAnalysis for old solver by compiler-errors · Pull Request #135899 · rust-lang/rust (original) (raw)
With the old solver there's always the possibility that we first computed a subtree and then used its cache entry to avoid the recursion limit 🤔
I thought that, but I also don't know what about the goal ordering would cause this to change, since we should approximately be proving goals in the same order as the previous strategy.
The only thing I could expect is something about this part of add_item_bounds_for_hidden_type:
| // We can't normalize associated types from `rustc_infer`, |
|---|
| // but we can eagerly register inference variables for them. |
| // FIXME(RPITIT): Don't replace RPITITs with inference vars. |
| // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. |
| ty::Alias(ty::Projection, projection_ty) |
| if !projection_ty.has_escaping_bound_vars() |
| && !tcx.is_impl_trait_in_trait(projection_ty.def_id) |
| && !self.next_trait_solver() => |
| { |
| let ty_var = self.next_ty_var(self.tcx.def_span(projection_ty.def_id)); |
| goals.push(Goal::new( |
| self.tcx, |
| param_env, |
| ty::PredicateKind::Clause(ty::ClauseKind::Projection( |
| ty::ProjectionPredicate { |
| projection_term: projection_ty.into(), |
| term: ty_var.into(), |
| }, |
| )), |
| )); |
| ty_var |
| } |
which changes the ordering of normalize/trait goals to affect caching to avoid overflow.
But even replacing everything with a call to add_item_bounds_for_hidden_type still doesn't fix this with the new reveal mode. 🤷