Commit 37b6533
committed
Auto merge of rust-lang#120942 - compiler-errors:deep-assoc-hang, r=lcnr
Ignore own item bounds in parent alias types in `for_each_item_bound`
Fixes rust-lang#120912
I want to get a vibe check on this approach, which is very obviously a hack, but I believe something that is forwards-compatible with a more thorough solution and "good enough for now".
The problem here is that for a really deep rigid associated type, we are now repeatedly considering unrelated item bounds from the parent alias types, meaning we're doing a *lot* of extra work in the MIR inliner for deeply substituted rigid projections.
This feels intimately related to rust-lang#107614. In that PR, we split *supertrait* bounds (bound which share the same `Self` type as the predicate which is being elaborated) and *implied* bounds (anything that is implied by elaborating the predicate).
The problem here is related to the fact that we don't maintain the split between these two for `item_bounds`. If we did, then when recursing into a parent alias type, we'd want to consider only the bounds that are given by [`PredicateFilter::All`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/astconv/enum.PredicateFilter.html#variant.SelfOnly) **except** those given by [`PredicateFilter::SelfOnly`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/astconv/enum.PredicateFilter.html#variant.SelfOnly).1 file changed
+16
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1605 | 1605 | | |
1606 | 1606 | | |
1607 | 1607 | | |
| 1608 | + | |
| 1609 | + | |
1608 | 1610 | | |
1609 | 1611 | | |
1610 | 1612 | | |
| |||
1618 | 1620 | | |
1619 | 1621 | | |
1620 | 1622 | | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
1621 | 1635 | | |
1622 | 1636 | | |
1623 | 1637 | | |
| |||
1627 | 1641 | | |
1628 | 1642 | | |
1629 | 1643 | | |
| 1644 | + | |
| 1645 | + | |
1630 | 1646 | | |
1631 | 1647 | | |
1632 | 1648 | | |
| |||
0 commit comments