rust/compiler/rustc_hir_analysis/src/coherence
bors d3df8ff851 Auto merge of #120780 - fmease:lta-in-impls, r=oli-obk
Properly deal with weak alias types as self types of impls

Fixes #114216.
Fixes #116100.

Not super happy about the two ad hoc “normalization” implementations for weak alias types:

1. In `inherent_impls`: The “peeling”, normalization to [“WHNF”][whnf]: Semantically that's exactly what we want (neither proper normalization nor shallow normalization would be correct here). Basically a weak alias type is “nominal” (well...^^) if the WHNF is nominal. [#97974](https://github.com/rust-lang/rust/pull/97974) followed the same approach.
2. In `constrained_generic_params`: Generic parameters are constrained by a weak alias type if the corresp. “normalized” type constrains them (where we only normalize *weak* alias types not arbitrary ones). Weak alias types are injective if the corresp. “normalized” type is injective.

Both have ad hoc overflow detection mechanisms.

**Coherence** is handled in #117164.

r? `@oli-obk` or types

[whnf]: https://en.wikipedia.org/wiki/Lambda_calculus_definition#Weak_head_normal_form
2024-02-18 03:58:56 +00:00
..
builtin.rs Just pass the checker instead of individual fields 2024-02-13 10:23:06 +00:00
inherent_impls_overlap.rs clean up potential_query_instability with FxIndexMap and UnordMap 2024-02-14 18:36:37 +08:00
inherent_impls.rs Support weak alias types as self type of inherent impls 2024-02-17 08:38:59 +01:00
mod.rs Don't reinvoke trait_header query twice 2024-02-13 09:38:13 +00:00
orphan.rs Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs 2024-02-06 02:22:58 +00:00
unsafety.rs Use fewer delayed bugs. 2024-02-14 20:30:37 +11:00