Segfault when returning deep function compositions #93237
Labels
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
C-bug
Category: This is a bug.
glacier
ICE tracked in rust-lang/glacier.
I-crash
Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
S-bug-has-test
Status: This bug is tracked inside the repo by a `known-bug` test.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This issue is tightly bound to this PR (93082), which aims to add the ability to return
impl Fn() -> impl Trait
from a function.I played around with it, and got the idea to test out if there is a limit to how deep we can nest those functions (since the PR also enables
impl Fn() -> impl Fn() -> impl Trait
). It quickly noticed a segfault fromrustc
and was able to determine the exact depth that causes the crash.Code
For generating test files quickly, I wrote a small code generator:
Once compiled, one can call it like this:
./gen <depth>
. Thedepth
argument controls the count of-> impl Fn()
that is emitted. The following listing is an example withdepth
set to 5:If one then tries to compile this with the rustc from the PR at commit 3ed486b37477dde94c87539, the test program compiles successfully.
However, when I set
depth
to 560, I get a segfault.Meta
rustc --version --verbose
:Error output
I got a backtrace from
gdb
:I am not entirely sure, if this is important enough for having it's own issue, since it's so tightly bound to the PR. Feel free to close / move accordingly.
The text was updated successfully, but these errors were encountered: