Skip to content

Rustdoc ICEs when a dependency has duplicate generic bounds to functions returning tuples #57180

Closed

Description

@lqd

Minimized from a failing rustc PR updating polonius, itself coming with a newer revision of datafrog.

There's a minimized reproduction here.
If you add this crate as a git dependency, and use it, like so:

use docfail::Leaper;

fn main() {
}

Rustdoc will crash while trying to build the doc for this dependent crate (note that it does not fail building docs in the docfail repo itself)

Crash details:

Documenting repro v0.1.0 (/Users/rrakic/Documents/rust/docfail)
thread '<unnamed>' panicked at 'assertion failed: output.is_none()', src/librustdoc/clean/simplify.rs:108:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.32.0-nightly (14997d56a 2018-12-05) running on x86_64-apple-darwin

error: Could not document `repro`.

The essence of the problem is the duplicate bounds on an impl inside the dependency:

pub trait Leaper {}

pub struct FilterAnti<Func>
{
    phantom: ::std::marker::PhantomData<Func>,
}

impl<Func: Fn() -> (u32)>
    Leaper for FilterAnti<Func>
where
    Func: Fn() -> (u32),
{
}

Removing either of the duplicate Fn(...) bound will work around the crash. The bound requires that the closure return a tuple, and the rustdoc trace seems to be code related to parentheses.

I can reproduce the crash on stable 1.31.0 (abe02cefd 2018-12-04), 1.31.1 (b6c32da9b 2018-12-18), an older nightly from the beginning of December (14997d56a 2018-12-05), but haven't bisected older releases.

I couldn't find other issues mentioning this, and the error only appeared in the aforementioned rust PR.

Thanks to @Mark-Simulacrum for the help in locating this quite uncommon issue.

Activity

  1. added a commit that references this issue on Dec 28, 2018
  2. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Dec 29, 2018
  3. Nashenas88 commented on Aug 26, 2019

    @Nashenas88
    Contributor

    I'll try to take this on later tonight.

  4. added a commit that references this issue on Aug 27, 2019
    c015927
  5. Nashenas88 commented on Aug 30, 2019

    @Nashenas88
    Contributor

    I tracked this bug down to this commit: 6aa7493 It's not clear to me exactly why this commit would cause that issue. Any idea @QuietMisdreavus ?

  6. Nashenas88 commented on Aug 30, 2019

    @Nashenas88
    Contributor

    Stems from this PR #53162

  7. Nashenas88 commented on Sep 10, 2019

    @Nashenas88
    Contributor

    After some more analysis today, I realize the above comment is not the cause of the issue. I was using cargo rustdoc in my bisect script. The above commit is what causes cargo rustdoc to start failing, but cargo doc was failing before this. I'll do some more bisect analysis to see if I can figure out when this really started.

    I reran cargo-bisect-rustc with cargo doc and got the same result. Not sure why cargo doc was giving a different result from cargo rustdoc earlier.

  8. added a commit that references this issue on Sep 27, 2019
    65af1ff
  9. added a commit that references this issue on Sep 27, 2019
    a37fe2d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions