1
Fork 0

Rollup merge of #130273 - lcnr:overflow-no-constraints, r=compiler-errors

more eagerly discard constraints on overflow

We always discard the results of overflowing goals inside of the trait solver. We previously did so when instantiating the response in `evaluate_goal`. Canonicalizing results only to later discard them is also  inefficient 🤷

It's simpler and nicer to debug to eagerly discard constraints inside of the query itself.

r? ``@compiler-errors``
This commit is contained in:
Matthias Krüger 2024-09-12 19:03:43 +02:00 committed by GitHub
commit cb1d80d1e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 35 deletions

View file

@ -302,7 +302,7 @@ fn fulfillment_error_for_stalled<'tcx>(
Ok((_, Certainty::Maybe(MaybeCause::Overflow { suggest_increasing_limit }))) => (
FulfillmentErrorCode::Ambiguity { overflow: Some(suggest_increasing_limit) },
// Don't look into overflows because we treat overflows weirdly anyways.
// In `instantiate_response_discarding_overflow` we set `has_changed = false`,
// We discard the inference constraints from overflowing goals, so
// recomputing the goal again during `find_best_leaf_obligation` may apply
// inference guidance that makes other goals go from ambig -> pass, for example.
//