rust/compiler/rustc_hir_analysis
Trevor Gross cff8e9ae14
Rollup merge of #140247 - BoxyUwU:iats_no_query_cycles, r=lcnr
Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs

Fixes rust-lang/rust#108491

Fixes rust-lang/rust#125879
This was due to updating inhabited predicate stuff which I had to do to make constructing ADTs with IATs in fields not ICE

Fixes rust-lang/rust#136678 (but no test added, I don't rly care about weird IAT edge cases under GCE)
Fixes rust-lang/rust#138131

Avoids doing "fully correct" candidate selection for IATs during hir ty lowering when in item signatures as it almost always leads to a query cycle from trying to build a `ParamEnv`. I replaced it with a use `DeepRejectCtxt` which should be able to handle this kind of conservative "could these types unify" while in a context where we don't want to do type equality.

This is a relatively simple scheme and should be forwards compatible with doing something more complex/powerful.

I'm not really sure how this interacts with rust-lang/rust#126651, though I'm also not really sure its super important to support projecting IATs from IAT self types given we don't even support `T::Assoc::Other` for trait-associated types so didn't give much thought to how this might fit in with that.

r? `@compiler-errors`
cc `@fmease`
2025-06-18 20:22:48 -04:00
..
2025-06-12 09:56:47 +02:00

For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.