rust/compiler/rustc_trait_selection/src/solve
许杰友 Jieyou Xu (Joe) 59ad2aec49
Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors
`-Znext-solver` caching

This PR has two major changes while also fixing multiple issues found via fuzzing.

The main optimization is the ability to not discard provisional cache entries when popping the highest cycle head the entry depends on. This fixes the hang in Fuchsia with `-Znext-solver=coherence`.

It also bails if the result of a fixpoint iteration is ambiguous, even without reaching a fixpoint. This is necessary to avoid exponential blowup if a coinductive cycle results in ambiguity, e.g. due to unknowable candidates in coherence.

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

For a general overview, see the in-process update of the relevant rustc-dev-guide chapter: https://hackmd.io/1ALkSjKlSCyQG-dVb_PUHw

r? ```@compiler-errors```
2024-08-14 21:43:07 +08:00
..
inspect Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors 2024-08-14 21:43:07 +08:00
delegate.rs valtree construction: keep track of which type was valtree-incompatible 2024-07-18 11:58:16 +02:00
fulfill.rs Store do_not_recommend-ness in impl header 2024-08-09 22:02:20 -04:00
inspect.rs Fix impl for SolverDelegate 2024-06-18 11:04:01 -04:00
normalize.rs Use assert_matches around the compiler 2024-08-11 12:25:39 -04:00
select.rs Move InferCtxtSelectExt out of eval_ctxt module 2024-06-16 11:28:47 -04:00