Skip to content

rustdoc: hang/OOM with recursive type #102910

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

Open
matthiaskrgr opened this issue Oct 11, 2022 · 3 comments
Open

rustdoc: hang/OOM with recursive type #102910

matthiaskrgr opened this issue Oct 11, 2022 · 3 comments
Labels
A-destructors Area: Destructors (`Drop`, …) C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Oct 11, 2022

I tried this code from tests/ui/recursion/issue-38591-non-regular-dropck-recursion.rs

struct S<T> {
    t: T,
    s: Box<S<fn(u: T)>>,
}

fn f(x: S<u32>) {}

fn main() {
    // Force instantiation.
    f as fn(_);
}
@matthiaskrgr matthiaskrgr added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Oct 11, 2022
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Oct 25, 2022

Some extra information:

rustdoc foo.rs 

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)

When building with rustc directly:

rustc foo.rs 
warning: unused variable: `x`
 --> foo.rs:6:6
  |
6 | fn f(x: S<u32>) {}
  |      ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

error[E0320]: overflow while adding drop-check rules for S<u32>
 --> foo.rs:6:6
  |
6 | fn f(x: S<u32>) {}
  |      ^
  |
  = note: overflowed on S<fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(fn(u32)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))>

error: aborting due to previous error; 1 warning emitted

@workingjubilee workingjubilee added the I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. label Mar 27, 2023
@fmease
Copy link
Member

fmease commented Nov 3, 2024

Triage: No change.

@fmease fmease added the fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. label Apr 17, 2025
@fmease
Copy link
Member

fmease commented Apr 17, 2025

At the time of writing the next trait solver seems to fix this. Not sure if that's coincidental/spurious or proper. Let's see.

@fmease fmease added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. A-destructors Area: Destructors (`Drop`, …) labels Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-destructors Area: Destructors (`Drop`, …) C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants