Uh oh!
There was an error while loading. Please reload this page.
Avoid mono collection hangs from recursive type growth - #156993
Avoid mono collection hangs from recursive type growth#156993naganohara-yoshino wants to merge 4 commits into
Conversation
rustbot
commented
May 26, 2026
rustbot has assigned @dingxiangfei2009. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
With this change, the code now terminates and reports the recursion-limit diagnostic: #![allow(dead_code)]enumFoo<A>{Fst,Snd(Box<dynFn() -> Foo<(A,A)>>),}fnrecursive<A>(x:Foo<A>){match x {Foo::Fst => (),Foo::Snd(f) => recursive(f()),}}fnmain(){let p0:Foo<()> = Foo::Fst;recursive(p0);}UI test is added accordingly. |
rustbot
commented
May 26, 2026
This PR modifies |
This comment has been minimized.
This comment has been minimized.
rustbot
commented
Jul 14, 2026
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer
cc @bjorn3 Some changes occurred in compiler/rustc_ast/src/expand/typetree.rs cc @ZuseZ4 Some changes occurred in check-cfg diagnostics cc @Urgau Some changes occurred in compiler/rustc_codegen_llvm/src/builder/autodiff.rs cc @ZuseZ4 Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 Some changes occurred in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs cc @ZuseZ4 Some changes occurred to diagnostic attributes. cc @mejrs This PR modifies If appropriate, please update These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
rustbot
commented
Jul 14, 2026
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
bjorn3
commented
Jul 14, 2026
Looks like you made a mistake with rebasing. Try |
080295f to
0d1dcceComparenaganohara-yoshino
commented
Jul 14, 2026
Thanks for your reminder. I think I have fixed it now. |
0d1dcce to
501b0abCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a788f4e to
c09dfb5Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c09dfb5 to
f4a7892Comparerustbot
commented
Jul 25, 2026
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Description
The mono item collector currently detects infinite recursive monomorphization
with a depth-based recursion limit. This can be too late for non-regular
recursive instantiations, where each recursive step produces much larger
instance arguments.
This PR starts checking the structural length of
instance.argsonce recursiveinstantiation is partway to the recursion limit. If the arguments already exceed
the type length limit, rustc emits the recursion limit diagnostic instead of continuing to process enormous types.
This keeps the diagnostic consistent with the error produced when the same code
is compiled with a smaller
#![recursion_limit].Related Issue
Fixes#156272.