Description
The function was added to prevent hangs during codegen if there are infinite expansions which result in exponential blowup. It does that by computing an estimate of the complexity of the type and checking whether it's above a limit:
rust/compiler/rustc_monomorphize/src/collector.rs
Lines 632 to 641 in 9c8a58f
This worked quite well, until we changed the walk
to use caching in #72412. It looks like nobody noticed its effect on the type length limit in this PR.
With this the type length estimate grows linearly while the "true" size of the type is still exponential, causing the limit to never be reached in the cases it's intended for. The only remaining test which hits the limit arbitrarily sets it to 8
and uses a linearly recursive type:
rust/tests/ui/type_length_limit.rs
Lines 10 to 30 in 9c8a58f