-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polymorphic_recursion.rs
takes longer to compile
#120912
Comments
@DianQK: Why did you title this "is broken"? It just takes longer to compile, or is it broken some other way? I'll look into the upcoming week. |
Sorry, it just takes longer to compile. |
polymorphic_recursion.rs
is brokenpolymorphic_recursion.rs
takes longer to compile
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium -regression-untriaged |
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).
On my machine (Apple M2 Pro), this test currently takes about 30 seconds. But if I enable I'm not sure whether it's actually stuck, or just taking an incredibly long time, but I've never seen it finish with debug assertions enabled. |
If I apply #120942, the test finishes in about 45 seconds with debug assertions enabled, and about 3 seconds with them disabled. |
Code
I tried this code:
https://github.com/rust-lang/rust/blob/1.76.0/tests/mir-opt/inline/polymorphic_recursion.rs
I expected to see this happen: It compiles quickly.
Instead, this happened: It takes 10s to complete.
Version with regression
Bisected to #120584.
cc @compiler-errors
The text was updated successfully, but these errors were encountered: