Rollup merge of #139762 - compiler-errors:non-env, r=lcnr

Don't assemble non-env/bound candidates if projection is rigid

Putting this up for an initial review, it's still missing comments, clean-up, and possibly a tweak to deal with ambiguities in the `BestObligation` folder.

This PR fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/173. Specifically, we're creating an unnecessary query cycle in normalization by assembling an *impl candidate* even if we know later on during `merge_candidates` that we'll be filtering out that impl candidate.

This PR adjusts the `merge_candidates` to assemble *only* env/bound candidates if we have `TraitGoalProvenVia::ParamEnv | TraitGoalProvenVia::AliasBound`.

I'll leave some thoughts/comments in the code.

r? lcnr
This commit is contained in:
Chris Denton 2025-04-19 15:09:34 +00:00 committed by GitHub
commit 88955849bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

Diff Content Not Available